Basically I want to highlight a JSON file but change highlight language for some values.
For example:
{
"foo": "normal json string",
"x": "var highlight = this.as('javascript')"
}
I’ve searched around but can only find examples/docs for v5.
So I’m looking at the docs and it seems I need to use parseMixed()
https://lezer.codemirror.net/docs/guide/#grammar-nesting
https://lezer.codemirror.net/docs/ref/#common.parseMixed
And I guess I should wrap things in a Language / LanguageSupport?
https://codemirror.net/docs/ref/#language.Language
But it isn’t really clear to me how it all goes together is there a simple example of this?
marijn
3
1 Like