Can I defined mixed syntax highlighting?

Basically I want to highlight a JSON file but change highlight language for some values.

For example:

    "foo": "normal json string",
    "x": "var highlight ='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()

And I guess I should wrap things in a Language / LanguageSupport?

But it isn’t really clear to me how it all goes together is there a simple example of this?

I published an example today:

1 Like