• Login
Community
  • Login

How can I write pug js codes in this editor?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 898 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E
    Emo Ser
    last edited by Nov 21, 2020, 2:59 AM

    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

    P 1 Reply Last reply Nov 21, 2020, 6:49 PM Reply Quote 0
    • P
      PeterJones @Emo Ser
      last edited by Nov 21, 2020, 6:49 PM

      @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)
          • Check the User Defined Languages Collection to see if anyone has already shared a UDL for “pug js” there – I don’t remember seeing it, but my memory is imperfect, or maybe it’s under a different name
          • If it’s not there, it’s not hard to make your own: see overview in official docs & see detailed guide
      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.

      E 1 Reply Last reply Dec 1, 2020, 4:36 AM Reply Quote 2
      • E
        Emo Ser @PeterJones
        last edited by Dec 1, 2020, 4:36 AM

        @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

        P 1 Reply Last reply Dec 1, 2020, 2:07 PM Reply Quote 0
        • P
          PeterJones @Emo Ser
          last edited by Dec 1, 2020, 2:07 PM

          @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.

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors