专用于支持 Markdown fenced code block 语法高亮。如果哪天官方支持了,就干掉这个库。
in vec4 position;
uniform mat4 matrix;
void main() {
gl_Position = matrix * position;
}
half3 ColorGrading(half3 color)
{
color *= _PostExposure;
float3 colorLutSpace = saturate(LUT_SPACE_ENCODE(color.rgb));
color = ApplyLut2D(TEXTURE2D_PARAM(_Lut2D, sampler_Lut2D), colorLutSpace, _Lut2D_Params);
return color;
}
// glsl 的代码,先顶着
in vec4 position;
uniform mat4 matrix;
void main() {
gl_Position = matrix * position;
}
Shader "Demo" {
Properties{
_MainTex("Base (RGB)", 2D) = "white" {}
}
HLSLINCLUDE
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
half4 _MainTex_TexelSize;
ENDHLSL
}
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. Thecontributes.grammars
section registers the injected grammar.syntaxes/codeblock.json
- The injected grammar itself
- In
syntaxes/codeblock.json
, change thebegin
rule fromsuperjs
to the identifier of your target language. This identifier is what people will write in markdown. - In
syntaxes/codeblock.json
, change the innerinclude
rule from"source.js"
to the scope of your target language. This scope can be found by looking at the target language's grammar. - In
syntaxes/codeblock.json
, change thecontentName
from usingsuperjs
to using a identifier for your language. This identifier may only contain letters but does not have to match the identifier from step 1. - In
syntaxes/codeblock.json
, change thescopeName
from usingsuperjs
to using a identifier for your language. This identifier may only contain letters but does not have to match the identifier from step 1. - In
package.json
, change thescopeName
to match the scopeName from step 4. - In
package.json
, changeembeddedLanguages
to map between thecontentName
from step 3 and the VS Code identifier for your language. - In
package.json
, change theid
from usingsuperjs-injection
to using an identifier for your grammar injection. This identifier does not have to match the identifier from step 1. - In
package.json
, change thelanguage
from usingsuperjs-injection
to using an identifier for your grammar injection. This identifier has to match the identifier from step 7.