How can I write pug js codes in this editor?



  • Peace be upon those who follow guidance
    how are you all
    I have a simple question:
    How can i use pug js in this editor?
    I have tried the vs code editor, but it is bad for me
    I would like to know how to use this technique in this editor
    Thank you



  • @Emo-Ser ,

    There are two interpretations for your question that I can come up with (after searching and finding out what “pug js” was):

    1. You are editing pug js code, and want syntax highlighting:

      • there isn’t a builtin lexer (syntax highlighter) for pug js.
      • I recommend using a User Defined Langauge (UDL)
    2. You want to pass the source code of the file being edited into the pug compiler executable

      • Using the Run > Run feature, and assuming the “pug compiler” executable (if there is such a thing) were at c:\app\pug\pug.exe, you could enter the command c:\app\pug\pug.exe "$(FULL_CURRENT_PATH)" or something similar; you can even save that command for later, and assign a keyboard shortcut, so you can easily run “compile this file” on demand
      • if your command to “compile” is more complicated, the NppExec plugin allows you to run full scripts that do lots of commands (like save the current file, compile, link, and run the resulting executable), all with one command (which can be associated with a single keystroke). If you want something like that, search the forum for “NppExec” (especially posts by me or @Michael-Vincent, who have both shared NppExec script examples multiple times), or give us the example of the Windows cmd.exe or powershell commands that you’d normally use to manually compile, and we can help you come up with an appropriate NppExec script.

    If this doesn’t answer your question, or you need further clarification, feel free to ask more. But when you do, please make sure you give us enough to go on.



  • @PeterJones

    ello, I apologize for the delay, I totally forgot that I asked a question
    And I went and raised the question again in a new post, so we both seem to have, by God knows, a weak memory
    Well, regarding my question:

    The pug js technique is a technique that contributes to writing html5 codes in a more professional way and gives programming properties such as conditional functions, shortcuts, etc.

    https://pugjs.org/api/getting-started.html

    I would like to write these codes so that there is a custom color as is the case with the plugins for the vsc editor, and that it supports errors and code completion

    Is there such a thing or not?

    Thank you



  • @Emo-Ser ,

    It appears you want syntax highlighting. I already gave you links to learn how to create a UDL for pug js, which will add syntax highlighting.

    If, instead, you want to extend the HTML lexer, so that the pug js code is in a different color than any of the normal HTML tags, then you can add extra highlighting to a builtin lexer (like the HTML lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo

    If I have not answered your question sufficiently, then maybe you can try asking more specific questions, and someone else can try to interpret your desires and give a better answer, because I don’t know what more I can say.

    Good luck.


Log in to reply