Creating a User Defined Language in Notepad++ based HEAVILY off HTML
-
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?
-
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.
-
@peterjones Thanks for all that great information!