Programmatically inject language in custom language highlighter

Answered

Hello all

I am writing a plugin that highlights a custom language. The highlighting is pretty much done already. The language is structured like this:

 

Key1: Value1
Key2: Value2

#-- Start of message1 --#
random
test
in a certain
format

#-- Start of message 2 --#
another random string

 

Now the part that is indicated as "random" strings is actually not random. Based on the key-value pairs I can infer what language this part is. Notably this could be XML or JSON. My highlighter currently puts both of these into a specific token called 'MESSAGE'. However I would like to use XML or JSON highlighting for this token. Would I use injected languages for this or should I delegate this to a different highlighter somehow?

BR
Yanick

1 comment
Comment actions Permalink

Yanick,

Injected language is definitely the way that you should follow. 

0

Please sign in to leave a comment.