ganesshkumar / obsidian-table-editor

An Obsidian plugin to provide an editor for Markdown tables. It can open CSV data and data from Microsoft Excel, Google Sheets, Apple Numbers and LibreOffice Calc as Markdown tables from Obsidian Markdown editor.
MIT License
215 stars 15 forks source link

[Question] Code Highlight for Excel Commands Syntax #41

Closed FelipeRearden closed 2 years ago

FelipeRearden commented 2 years ago

Hello @ganesshkumar !!!!!

Sorry to bother you with a question that is not 100% related to this plugin.

I’m, finally starting to migrate my EXCEL knowledge to an Obsidian note and I’d like to ask something …

Do you know if there is an code syntax highlight for EXCEL commands.

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

Is there any code syntax that I could use to highlight the arguments of a command in a code block ?

1FAFEB08-1FDC-4AF4-965A-9E9436BDD253


Thanks for your help :)

I wish you a fantastic day!

ganesshkumar commented 2 years ago

It actually depends on what syntax highlighter tool/library Obsidian uses.

Theoretically it is possible to hightlight excel syntax by using something like https://highlightjs.org but it looks like Obsidian is using HyperMD's syntax highlighting.

Can you check with the Obsidian community over the discord server on the same? If there is no immediate fix from the team, then we can check how to support this. Just wanted to make sure the work is not duplicated across the tool and a plugin.

FelipeRearden commented 2 years ago

It actually depends on what syntax highlighter tool/library Obsidian uses.

Theoretically it is possible to hightlight excel syntax by using something like https://highlightjs.org but it looks like Obsidian is using HyperMD's syntax highlighting.

Thank you very much for your reply and explanation @ganesshkumar !!! You are super :)

Can you check with the Obsidian community over the discord server on the same?

Sure ! I create this message under the#plugin-dev channel ...

Here is the link -> https://discord.com/channels/686053708261228577/840286264964022302/984871830642901102

I get to you when I get a reply 🙏 🙏 🙏

If there is no immediate fix from the team, then we can check how to support this. Just wanted to make sure the work is not duplicated across the tool and a plugin.

Thank you very much for your attention with my question/idea


Let's keep talking.

Have a great day!!!!

FelipeRearden commented 2 years ago

@ganesshkumar we got an answer !!!!

It's PrismJS for Reading View

image

I am gonna keep searching for some information about Live Preview

Thanks again for your help !!!!

ganesshkumar commented 2 years ago

@FelipeRearden, From their documentation looks like you can enter one of the following as the language excel-formula, xlsx, xls

image

outputs

image

FelipeRearden commented 2 years ago

@FelipeRearden, From their documentation looks like you can enter one of the following as the language excel-formula, xlsx, xls

This is amazing @ganesshkumar !!!

Thank you very much for your help and forgive for my lack of knowledge about code. I couldn't get this information without your help.

The question is 100% answered :)


Let me share something with you just to close this topic ...

The only thing that I miss from excel-formula, xlsx, xls is the ability to highlight the argument name

My idea for a EXCEL knowledge note would be a note that has the formula argument highlighted inside the codeblock and a table to explain the behavior of each argument wit my own words/experience.

image

[WIP] Something like this ....

image


Would you mind sharing the GitHub link for the documentation?

I'm thinking about creating an FR about supporting highlight for arguments as well :)

Again thanks for your help !!!!!!

ganesshkumar commented 2 years ago

@FelipeRearden, here is the link to PrismJS's repo - https://github.com/PrismJS/prism.

ganesshkumar commented 2 years ago

Little more context, a rendered syntax like the below

image

has the following html

<code class="language-xls is-loaded">
  <span class="token operator">=</span>
  <span class="token function-name builtin">VLOOKUP</span>
  <span class="token punctuation">(</span>
  lookup_value
  <span class="token operator">,</span>
  table_array
  <span class="token operator">,</span>
  col_index_num
  <span class="token operator">,</span>
  <span class="token punctuation">[</span>
  range_lookup
  <span class="token punctuation">]</span>
  <span class="token    ###punctuation">)</span>
</code>

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.

FelipeRearden commented 2 years ago

@FelipeRearden, here is the link to PrismJS's repo - https://github.com/PrismJS/prism.

Thank you very much @ganesshkumar !!!!

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 is absolutely amazing @ganesshkumar !!!!!!

I am gonna create the FR and share all of your this knowledge with them.

Let's hope they add support for this 🙏 🙏 🙏 🙏 🙏

I am gonna close this issue but I keep you updated if/when I get an reply.


Thank you very much for always helping me :)

Have a great day!