Injected languages are important for languages like HTML which might embed CSS or JavaScript code blocks.
Example Use Cases
HTML implements CSS, JavaScript
JavaScript implements regex, jsdoc, HTML/React
Injections.scm
Some grammars that support injections have an additional injections.scm file in their queries folder.
An example is tree-sitter-html:
((script_element
(raw_text) @injection.content)
(#set! injection.language "javascript"))
((style_element
(raw_text) @injection.content)
(#set! injection.language "css"))
We need to figure out how to parse and load the associated injected languages in addition to the base language itself.
Resources
Injected languages are important for languages like
HTMLwhich might embedCSSorJavaScriptcode blocks.Example Use Cases
HTMLimplementsCSS,JavaScriptJavaScriptimplementsregex,jsdoc,HTML/ReactInjections.scm
Some grammars that support injections have an additional
injections.scmfile in theirqueriesfolder.An example is tree-sitter-html:
We need to figure out how to parse and load the associated injected languages in addition to the base language itself.
Resources