Community

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

    Custom Styles for 'Special' Comments

    Help wanted · · · – – – · · ·
    3
    4
    160
    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.
    • Thomas Benedict
      Thomas Benedict last edited by

      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
      • PeterJones
        PeterJones last edited by

        @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
        Thomas Benedict Ekopalypse 2 Replies Last reply Reply Quote 2
        • Thomas Benedict
          Thomas Benedict @PeterJones last edited by

          @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
          • Ekopalypse
            Ekopalypse @PeterJones last edited by

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