How to: {{Moustache}} code highlighting for Notepad++



  • Hi folks!

    I have some .php files with Moustache {{}} code in them, and would like the code to be “highlighted correctly” by Notepad++.

    At the moment all is black and unrecognised!

    What steps must I undertake to enable Moustache{{ }} code highliting?

    Please do a step by step as i’m not a seasoned programmer, just content writer who happens to have fall in love with Notepad++ ;)

    Thanks!



  • @Sam-Zam

    npp uses scintilla as its syntax highlighting engine.
    In order to make this work, the php (and maybe the html ) lexer needs to be changed.
    I found a discussion from 2012 and the author of scintilla
    refused to implement this.

    Cheers
    Claudia



  • Dear Claudia

    Thank you for your answer. Does that mean that it is not possible let alone easy to have {{moustache}} syntax working in Notepad++?

    Greetings, Sam



  • @Sam-Zam

    Does that mean that it is not possible let alone easy to have {{moustache}} syntax working in Notepad++?

    Yes, the only save way to make this happen is to change the lexer.

    Cheers
    Claudia



  • RegEx Helper as a plugin can offer some help (assuming that RegEx Helper is already installed):

    Open your file in Notepad++
    Set the language to Php
    Launch the plugin using Ctrl+F12
    Type in the “Regular Expression” window: ({{)|(}})
    Turn on the highlighting using ‘Mark’ button.

    Tested using this Moustache template:
    <strong>Hello, {{firstname}}</strong><br>
    <p>You are visitor number {{visitorNumber}}.</p>


Log in to reply