• Resolved rickmaurinus

    (@rickmaurinus)


    Hi there,

    I have a question about the following.

    On my website I’m currently highlighting the Power Query M language with a custom brush. This language has certain specifics that need highlighting. Currently I have three different variables to highlight:

    var funcs = ' #table number.from number.fromtext number.totext number.isnan
    var specials = 'null date number text time table'
    var keywords = 'each if then else type true false meta let in'

    I have the following questions about this:

    1.1. In the ‘var funcs’ part, everything is highlighted correctly, except for the functions starting with a #. In this case ‘#table’ does not get the correct highlighting. Can the plugin highlight functions containing #, and if so how?

    1.2 If the previous is possible (highlighting #+ name) the following question arises. I would like to differentiate between: table and #table. One is in var funcs and the other in var specials. Those are used in different ways. One is an intitializer for a table, one if a data type. Can I apply an order in which highlighting takes place? Ideally the plugin would first highlight ‘#date’, and only then search for values that look like ‘date’

    2.1. Is it possible to also highlight brackets like: ( ) and { } and [ ]?

    2.2. If previous is possible, is it even possible to color nested brackets differently. So that users can easily identify which brackets refer to which branch in a statement? With a nested statement of 2 layers, the outer layer brackets could be yellow, the inner layer brackets could be pink for example.

    Your response is highly appreciated!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @rickmaurinus ,

    > 1.1. In the ‘var funcs’ part, everything is highlighted correctly, except for the functions starting with a #.

    You should be, but honestly, Syntax Highlighter is reliant upon a library which is no longer updated (and for which very little documentation remains online). It’s possible that it could be related to your regex that your code not picking up the #.

    I did find this:
    https://github.com/selimovd/SyntaxhighlighterBrush-M-PowerQuery/blob/main/shBrushM.js

    Which may be a helpful example of another Power Query M brush (from 2021).

    > Can I apply an order in which highlighting takes place? Ideally the plugin would first highlight ‘#date’, and only then search for values that look like ‘date’

    Theoretically yes, but it would require custom code, which is outside of our scope of support.

    > 2.1. Is it possible to also highlight brackets like: ( ) and { } and [ ]?

    See above.

    > is it even possible to color nested brackets differently. So that users can easily identify which brackets refer to which branch in a statement?

    It is possible, yes (custom code).

    You might take a look at some of our existing brushes to see how they were done:

    https://github.com/Automattic/syntaxhighlighter/tree/master/syntaxhighlighter3/scripts

    and the original library to see how it works:

    https://github.com/syntaxhighlighter/syntaxhighlighter/tree/3.0.83

    Sorry I couldn’t be of more help here!

    Best,
    Cena

    Thread Starter rickmaurinus

    (@rickmaurinus)

    Thanks Cena, I’ll look into your suggestion. I just wanted to check how far the support reaches. I thought you may have been interested in the topic for plug-in improvement.

    I’m -quite happy already with the current working of the plug-in. Thanks again!

    Plugin Support Jay

    (@bluejay77)

    Hi @rickmaurinus,

    Regarding the scope of support – current plugin support is done by a team from Automattic. We’ve decided to take on the support and maintenance of the original author’s plugins since his passing. You can read more about that here.

    We try to stay on top of any queries and maintain the plugin, but we are not actively adding new features or developing the plugin.

    We’re glad to hear that you’re happy with the plugin as-is :)! If you have any further questions or need some more help, you’re welcome to reply here or open another thread.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Highlighting special characters’ is closed to new replies.