Demonstrates how an extension can inject support for a new grammar in VSCode's builtin markdown grammar for fenced code blocks. This extension injects an alias for JavaScript called superjs
so support editor highlighting of blocks that look like:
```superjs
someJsCode
```
package.json
- VS Code extension manifest file. The contributes.grammars
section registers the injected grammar.syntaxes/codeblock.json
- The injected grammar itselfsyntaxes/codeblock.json
, change the begin
rule from superjs
to the identifier of your target language. This identifier is what people will write in markdown.syntaxes/codeblock.json
, change the inner include
rule from "source.js"
to the scope of your target language. This scope can be found by looking at the target language's grammar.syntaxes/codeblock.json
, change the contentName
from using superjs
to using a identifier for your language. This identifier may only contain letters but does not have to match the identifier from step 1.syntaxes/codeblock.json
, change the scopeName
from using superjs
to using a identifier for your language. This identifier may only contain letters but does not have to match the identifier from step 1.package.json
, change the scopeName
to match the scopeName from step 4.package.json
, change embeddedLanguages
to map between the contentName
from step 3 and the VS Code identifier for your language.package.json
, change the id
from using superjs-injection
to using an identifier for your grammar injection. This identifier does not have to match the identifier from step 1.package.json
, change the language
from using superjs-injection
to using an identifier for your grammar injection. This identifier has to match the identifier from step 7.