Syntax highlighting for various languages is realized in languages.ts. Syntax highlighting for a new language can be easily implemented by adding a new entry to the lazyLanguages object.
The drawback, however, is that this requires updating SilverBullet itself. This is fine for mainstream languages, but less ideal for smaller niche languages.
So it'd be nice if the user could easily add support for new languages themselves without having to touch SilverBullet's installation, but instead by providing a user script (JavaScript). This user script would then be included when loading a page and could then access a function like addLanguage(...), which would update the lazyLanguages and allLanguageNames objects.
We talked about this on GitHub quite a while ago I think, but this is really hard due to the way lezer works. The short version is that both silverbullet on the "frontend" and the language need to bundle the same codemirror/lezer package otherwise stuff like instanceof just breaks (This was actually a bug once). This means you would have to define a new api for this which isn't easy.
Hmm, that'd make it challenging. When I get some spare time I'll consider tinkering with SB's source and see if I can come up with some alternative ideas.
Maybe the addLanguage() api can accept a synchronous function that takes the instance of codemirror/lezer as an argument and returns whatever you wanted to pass to addLanguage()
Then they'd be able to use the same instance of the package.