Java block <% %> in custom html language.

It has been an uphill process, but I am having fun configuring CodeMirror 6. :slight_smile:

I am coping @codemirror/lang-html to add custom tags hosting JavaScript code. These have similar functionality as <script>. These are working great with proper nesting and autocompetion. No problem on this side.

My question is: How should I modify the html.ts code to support JavaScript inside the block <% %>? These are common in JSP views code.

Thank you.

The HTML parser doesn’t parse <% %>, so you won’t find those in the syntax tree, and thus can’t target them for mixed language parsing. You’ll probably have to fork the HTML parser to support this syntax, or wrap the whole document with a parser that divides it into content inside and outside those tags, and parse the stuff outside as HTML, and the stuff inside as JavaScript using mixed parsing.