Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Modifying existing language settings

    Help wanted · · · – – – · · ·
    2
    5
    898
    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.
    • Ilisuan Iannis Patriciu
      Ilisuan Iannis Patriciu last edited by

      Hello!
      I would like to add some custom tags in Notepad++'s HTML syntax highlighting, so that both the tag and it’s attributes are colored accordingly.
      Is it possible to copy and modify OR import and edit the HTML language file from somewhere or do I have to do everything by hand (custom + official HTML tags) in the User-Defined Language window?

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Ilisuan Iannis Patriciu last edited by

        @Ilisuan-Iannis-Patriciu ,

        The HTML syntax highlighter doesn’t have any user-defined keyword slots in the Style Configurator > HTML settings. Unfortunately, that means you can’t add them to the builtin lexer.

        So you could use UDL (though it won’t have all the features of the HTML lexer), or you can add extra highlighting to a builtin lexer using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo

        1 Reply Last reply Reply Quote 1
        • Ilisuan Iannis Patriciu
          Ilisuan Iannis Patriciu last edited by

          That’s a bummer. Oh well, thank you for your answer!

          PeterJones 1 Reply Last reply Reply Quote 0
          • PeterJones
            PeterJones @Ilisuan Iannis Patriciu last edited by

            @Ilisuan-Iannis-Patriciu ,

            Actually, I just thought of and confirmed an alternative.

            The langs.xml config file (so probably in %AppData%\Notepad++\langs.xml if you have a normal installation) does list the standard tags that the HTML parser recognizes. If you follow best practices for editing config files, you can add a tag to the list, save, and then re-start Notepad++. For example, here’s a screenshot after I told Notepad++ that <aardvark> was a valid HTML tag, but not <anteater>:

            301c41c6-a472-426d-8cc1-3bb2c6736513-image.png

            Note that <aardvark> and its attributes are colored just like normal tags, but <anteater> is still in default color because it’s not a recognized tag name.

            1 Reply Last reply Reply Quote 4
            • Ilisuan Iannis Patriciu
              Ilisuan Iannis Patriciu last edited by

              @PeterJones This worked just the way I wanted. Thanks!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors