Nova 10+ Syntax Highlighting Broken on Closing Tag (Twig Plugin, Regex)

my name is Tim-Patrick and I’m the developer of the Twig language plugin for Nova. Twig is a PHP-based templating language used by many projects, e.g. Drupal or Craft CMS.

I think I found an issue with syntax highlighting in Nova 10+.

Recently I tried to add support for nested code blocks. In Twig, they look like this:

{% css %}
h1 { color: red }
/* … */
{% endcss %}

They must behave like fenced code blocks in Markdown. However, the opening and closing tags should be highlighted like regular Twig tags.

My language plugin has two syntax definitions: Twig-HTML (Twig code alongside regular HTML tags) and Twig (Twig code inside brackets). It’s pretty similar to the original PHP-syntax (before the Tree-sitter update).

I added a scope to the “Twig-HTML” syntax definition to catch fenced code blocks: Twig.novaextension/Twig-HTML.xml at main · tpmatthes/Twig.novaextension · GitHub

In Nova 9.x, it worked just fine. However, in Nova 10.3, the end tag {% endcss %} won’t get highlighted. When I inspect it, I can see that Nova 10.3 applies the right classes, but the text doesn’t get highlighted correctly. I’ve attached a few screenshots from Nova 10.3, all of them show the same file and use the same Plugin version (1.8.1, not published yet).

Here’s a link to the plugin (not published yet): Release Version 1.8.1 · tpmatthes/Twig.novaextension · GitHub

I did some troubleshooting (updating to Nova 11, switching to a different theme, removing all plugins), but couldn’t find a solution. Is this a bug with the syntax highlighting in Nova 10+?

Thank you,