Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support for EXCEL Formula Arguments Syntax on xlsx #3479

Open
FelipeRearden opened this issue Jun 18, 2022 · 5 comments
Open

Comments

@FelipeRearden
Copy link

FelipeRearden commented Jun 18, 2022

Hello friends !!!!

My FR is about a little feature to be added when using the syntax xlsx or xls .

In many cases we need to present the argument of an EXCEL formula instead of the cell.

=FORMULA(argument_1,argument_2)

=VLOOKUP(lookup_value,table_array,col_index_num, [range_lookup])

We only get syntax highlight when inserting cells

=FORMULA(A1,A2)

=VLOOKUP(A1,A2,A3,A4)

Why I am asking this ?

The Note-taking App Obsidian uses PrismJS to highlight code syntax .

I am creating a documentation about my EXCEL formula knowledge and I want to describe the formula arguments as a code block.

Suggestion of Implementation

I was talking about this idea with ganesshkumar on this Issue here

ganesshkumar suggests these approach:

Little more context, a rendered syntax like the below

image

We can see that the arguments are not wrapped inside span elements and are not annotated with classes - token, argument or text. If they can wrap the arguments in span with some css classes then we can use some custom css in obsidian to show the alternating arguments in different colors as you are expecting.

This the original comment with all the details.

I was not able to insert images in this issue (I don’t know why) but I tried the best to show my FR.


Thanks for reading this. Let me know if something is not clear.

Have a great day!

@FelipeRearden FelipeRearden changed the title [Feature Request] Support for E [Feature Request] Support for EXCEL Formula Arguments Syntax on xlsx Jun 18, 2022
@RunDevelopment
Copy link
Member

In many cases we need to present the argument of an EXCEL formula instead of the cell.

=FORMULA(argument_1,argument_2)

=VLOOKUP(lookup_value,table_array,col_index_num, [range_lookup])

We only get syntax highlight when inserting cells

=FORMULA(A1,A2)

=VLOOKUP(A1,A2,A3,A4)

Please clarify what you mean. Functions take arguments, so any arbitrary expression (variables, cells, functions calls, etc.) can be an argument. Why exactly do you want highlighted?

@FelipeRearden
Copy link
Author

Hello @RunDevelopment !!!!

Thank you very much for your reply :)

Please clarify what you mean.

Sorry for my bad explanation. Let me be more clear about my FR.

Functions take arguments, so any arbitrary expression (variables, cells, functions calls, etc.) can be an argument.

1️⃣ EXCEL Fundamentals

AN EXCEL formula is designed is with elements

  • Formula_Name: the name of the formula in the screen;
  • Arguments: the type of the input the the user have to define when using the formula. (This is the term used by Microsoft).

For example the EXCEL formula VLOOKUP has these structure:

Formula_Name -> VLOOKUP

Arguments

  • lookup_value,
  • table_array
  • col_index_num
  • [range_lookup]

2️⃣ EXCEL Formula Syntax

The EXCEL formula syntax is this :

=formula_name(argument_1, argument_2, argument_3)

💡 each argument is separated by comma

For Example with the VLOOUP formula.

=VLOOKUP(lookup_value,table_array,col_index_num, [range_lookup])

Why exactly do you want highlighted?

MY FR is to highlight the arguments

1ADE0950-4E5F-4056-8EB2-D2B718D66B15

When I use the codeblock above, this what we get:

118AE7EC-7FD1-4949-8CF1-6011AC35BE25

This is my FR 🙏 :

5EC2E1C5-1C6A-4386-88D5-31A7AF33E75D


Let me know if something is not clear know !

Thanks for reading this!

Have a great day

@FelipeRearden
Copy link
Author

Hello @RunDevelopment

Sorry to bother you :)

Just to know if my FR is now clear (from my previous comment)

Thanks.

@RunDevelopment
Copy link
Member

Sorry for the delay!

Yes, it's clear now. Unfortunately, this won't be too easy to implement. The problem is that to wrap an argument, we need to match arbitrary expressions, which isn't possible with regexes (context-free grammar vs regex). So we'll have to use a few tricks to make this happen.

@FelipeRearden
Copy link
Author

Sorry for the delay!

No problem 😀 !!!! Sorry again for bothering you :)

Yes, it's clear now.

I'm glad to know that is clear :)

Unfortunately, this won't be too easy to implement. The problem is that to wrap an argument, we need to match arbitrary expressions, which isn't possible with regexes (context-free grammar vs regex). So we'll have to use a few tricks to make this happen.

I appreciate you feedback ! My hope is that would be something easy to implement :)

I am going to start to create my EXCEL documentation in Obsidian maybe in the future we get the highlights for the EXCEL arguments.

Thanks and have a great day!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants