Community
    • Login

    Creating a User Defined Language in Notepad++ based HEAVILY off HTML

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.1k 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.
    • Michael833M
      Michael833
      last edited by

      I’m working in a program (called Tangerine) that uses HTML and sprinkles in a bit of Javascript. I’ve created a User Defined Language in Notepad++, to help me with the folding of the code, but in doing that I’ve lost the very nice highlighting that I would get if I used the native HTML text highlighting language in N++.

      Is there some way that I can define a language in N++ such that it imports the HTML language, but then let’s me create my own folding points? When I look at the folder of language .xml files on GitHub, I see many languages, but not HTML. There is one called Twig-HTML, but I think that may be something different.

      Or, is there some place where I can find what I need to place into my UDL fields (“Keywords List”, “Comment & Number”, etc.) to make it look and operate more like the native HTML language?

      Could I maybe even find a way to get Javascript highlighting also, given specific start/end points for that JS to be encapsulated within?

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

        @michael833 ,

        The built-in languages and UDL are completely independent entities, so there is no way to make a UDL “inherit” from a built-in parser like the HTML lexer. Sorry. So you’d just have to find a list of HTML keywords, noting that because so many keywords in HTML are really tag names, you might have to do things a bit differently. (And remember, the UDL keyword matching is less sophisticated than what’s available in the built-in HTML lexer, so you probably wouldn’t be able to replicate everything from the HTML-lexer in a UDL.)

        It might be possible to use the PythonScript plugin to run a script that adds or replaces folding in a given file, on demand. There is an example of this in my post from a recent conversation – that was in a plaintext file, rather than an HTML file, but you might be able to be re-work it for your needs.

        Michael833M 1 Reply Last reply Reply Quote 4
        • Michael833M
          Michael833 @PeterJones
          last edited by

          @peterjones Thanks for all that great information!

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