Creating a simple extension syntax… examples? Guidance

I’m not finding the documentation on how to create a language extension syntax simple.

All I want to do is define multiline comments embedded inside .ts, .js, and .css files (for starters) that start with a bang as being markdown and, ideally, embedded code in markdown as being of the appropriate language so that:

Note that I’m using the tag here because quoting the markdown for it is fraught :smiley:

<pre>js
// is treated as javascript
</pre>

I’ve written a documentation system that relies on this (I used to use /** */ but so many programs — visual study code, cough — treat that as jsDoc that I gave up. It even finds contiguous sets of code comments and assembles them into live examples (“fiddles”). You can check it the <live-example> web-component here if you’re curious.

The documentation says this only works for syntaxes defined using tree sitter but there’s no information on whether the ts, js, or css grammars build into Nova qualify.

Anyway, thanks in advance if you have any pointers.

The ts, js, and css are all tree-sitters based grammars. :deciduous_tree:

I do not think this is possible at the moment. I however done a similar feature request for this on the dev forum not long ago. It is actually something very useful with countless use cases including the one you mentioned here. Hopefully as more of us start asking, they would eventually add support? :eyes:

It is definitely technically possible but I am not sure how they would implement it. I hope the API is a clean one!

There is also a NeoVim example on the feature request on how you might be able to achieve this, once, if ever supported, but again this is very dirty, you need to dig and mess around with each tree-sitters grammar manually which in turn might break things etc. :joy: I am really not a fan of that for sure!