tinymist/syntaxes/textmate/README.md
Myriad-Dreamin 08b9c10aa1
docs: improve and add contribution guide for syntaxes (#471)
* dev: reformat metadata of raw languages

* docs: improve and add contribution guide for syntaxes
2024-07-27 23:04:52 +08:00

1.1 KiB

Syntax Highlighting for Typst

This folder contains the syntax highlighting for Typst. The syntax highlighting is written in the TextMate format.

The syntax highlighting is written in TypeScript, and ensures correct grammar by ./textmate.ts.

Building

The following script running the TypeSCript program will generate the TextMate grammar file:

yarn compile

Testing

yarn test

Register languages for raw highlighting

Goto fenced.meta.mts and add a line like this:

{ "candidates": ["erlang"] }

Three possible kinds:

  • { candidates: ["someLanguage", ...rests] } - using textmate parser registered as source.someLanguage.
    • The rests of the candidates can also be used as language tag of fenced code blocks.
  • { as: "text.xxx", candidates } - using textmate parser registered as text.xxx.
  • { as: ["text.xxx", ...restScopes], candidates } - using textmate parser text.xxx first, and restScopes parsers in order.

Contributing

See CONTRIBUTING.md.