I’ve written a very simple syntax highlighter for jq for CodeMirror 6:
It doesn’t actually tokenize for valid syntax like many other Lezer highlighters do, it just looks for keywords, numbers, strings, etc. and highlights them. (It might be buggy, issues/PRs are of course welcome!) Here’s a simple demo with CM6 and the highlighter: https://nsjwjz.csb.app/
Could something like this be added to Exercism? I’d appreciate it when coding in jq
Exercism’s web editor relies on Highlight.js for syntax highlighting. Any highlighting that shows up in the editor needs to show up there, first. If you’d like to add a language, that’s where you need to look.
@iHiD I’ve already got .online_editor.highlightjs_language = "jq"
I suppose these packages need to be added to the website package.json, and jq snippets need to be regenerated?
Thank you for your contributions. Both packages look really good and work well. Unfortunately, I can only add the hljs one for now, because we still use Codemirror 6’s ^0.19.0 version. It is planned to upgrade CM6 to ^6.0.0 , but a lot of things can break, and it requires some time to fully test it and replace the breaking parts.
The reason we can’t resolve a different version of libraries in your dependencies is that @codemirror/highlight has been split between @lezer/highlight and @codemirror/language , and we still need the former.
In the meantime, a possible solution could be publishing another version of your lang-pack that is built on top of @codemirror/highlight and @codemirror/language , both ^0.19.0 , instead of your current ones: @codemirror/language": "^6.0.0" and @lezer/highlight .