Community
    • Login

    UDL Delimiter after break and whitespace only

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 286 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.
    • Ruby GoodyR
      Ruby Goody
      last edited by

      I’m trying to make a UDL for markdown and everything works, except when the character # is used in the middle of a text. Then suddenly the rest of the text becomes styled like a heading.
      How can I make sure my # delimiter styling only happens when the character # only appears after newline and whitespace… I tried regexp before, but it doesn’t work or N++ uses other regexp here?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Ruby Goody
        last edited by PeterJones

        @Ruby-Goody ,

        Notepad++'s UDL system does not accept regexp.

        Thus the UDL system as designed cannot differentiate between a # at the beginning of the line and one in the middle of the line for delimiters and operators. That is a limitation of the UDL system. But if you look at the Markdown (preinstalled) UDL that ships with Notepad++ (which you could be using, rather than defining your own, BTW), it uses the Comment line style for headers, and the Comment Line can require that the comment line only start at the beginning of the line, or only at the beginning of the line (with optional whitespace). So by using Comment Line instead of Operator or Delimiter, it should work as expected.
        8d9eed58-d3ad-4d9c-b0d9-81d0ee6a749f-image.png

        If that’s not sufficient, but you are willing to use a plugin to help things out, the EnhanceAnyLexer plugin will allow adding a layer where a regex is used to decide on the foreground color for individual built-in lexers or UDL languages. You can install that plugin from the Plugins Admin interface in Notepad++. To use that plugin, you would define your UDL without defining # for headers; then you would use Plugins > EnhanceAnyLexer > Enhance Current Language, and then add a line in the config file where the plugin started you, something like

        0x0080FF = ^\h*#.*$
        

        … which would convert the entire line to orange foreground if it starts with zero or more spaces or tabs followed by a #

        1 Reply Last reply Reply Quote 1
        • Terry RT Terry R referenced this topic on
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors