• Login
Community
  • Login

Custom Styles for 'Special' Comments

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 3 Posters 712 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.
  • T
    Thomas Benedict
    last edited by Sep 25, 2019, 8:34 PM

    I have html code which has special tags embedded in comments which I would like to display in a custom style in Notepad++. I’ve tried adding these special tags to keywords or operators/delimiters in the UDL, but the comments style seems to have precedence.

    Is there any way to do this?

    Thanks,

    Tom

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Sep 25, 2019, 9:46 PM

      @Thomas-Benedict said in Custom Styles for 'Special' Comments:

      I have html code which has special tags embedded in comments which I would like to display in a custom style in Notepad++. I’ve tried adding these special tags to keywords or operators/delimiters in the UDL

      So I see a conflict: do you want to use a UDL (Language > Define Your Language ) for styling HTML, or the builtin HTML lexer (Settings > Style Configurator > HTML )? The two don’t mix: you can have only one active lexer at a time.

      If as a UDL, there are nuances that you will lose, but you can define any keywords you want, in multiple groups. And you can set the comment syntax so that it allows nesting of other keyword groups that you want. See the UDL section in the usermanual

      If using the builtin HTML lexer, unfortunately Settings > Style Configurator > HTML dialog doesn’t seem to list any styles that have user-defined keywords. And even if you could, I think comments would override that.

      However, there are workarounds:

      • you can add extra highlighting to a builtin lexer (like the HTML lexer) using regexes via the script EnhanceAnyBuiltinLexer.py that @Ekopalypse shares, in this linked post
      • you can add extra highlighting to a UDL language using regexes via the script EnhanceUDLLexer.py that @Ekopalypse shares in this linked post
      T E 2 Replies Last reply Sep 26, 2019, 2:24 PM Reply Quote 2
      • T
        Thomas Benedict @PeterJones
        last edited by Sep 26, 2019, 2:24 PM

        @PeterJones said in Custom Styles for 'Special' Comments:

        So I see a conflict: do you want to use a UDL ([Language > Define Your Language](https://npp-user-manual.org/docs/user-
        If using the builtin HTML lexer, unfortunately Settings > Style Configurator > HTML dialog doesn’t seem to list any styles that have user-defined keywords. And even if you could, I think comments would override that.

        I was hoping to simply modify the built in HTML lexer. Thanks for confirming that that is not possible.

        However, there are workarounds:

        • you can add extra highlighting to a builtin lexer (like the HTML lexer) using regexes via the script EnhanceAnyBuiltinLexer.py that @Ekopalypse shares, in this linked post
        • you can add extra highlighting to a UDL language using regexes via the script EnhanceUDLLexer.py that @Ekopalypse shares in this linked post

        I will check these out, but regex is usually challenging for me. I’ll give it a go.

        Thanks again,

        Tom Benedict

        1 Reply Last reply Reply Quote 1
        • E
          Ekopalypse @PeterJones
          last edited by Sep 27, 2019, 2:37 PM

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors