Wilfred / difftastic

a structural diff that understands syntax 🟥🟩
https://difftastic.wilfred.me.uk/
MIT License
20.59k stars 333 forks source link

Dynamic sublanguages (injections) #717

Open arbrauns opened 4 months ago

arbrauns commented 4 months ago

Some languages support arbitrary sublanguages inside tagged code blocks, for example some python code inside this Markdown text:

print("Hello world!")

It would be great if difft supported such tags and used the correct sublanguage parser for the code blocks. My specific usecase is Typst, which has the same code block syntax as Markdown but also a lot more features that make a tree-sitter parser very useful.

There seems to be a (semi-?)standard way of specifying these sublanguage blocks, injection queries.