tinymist/syntaxes/textmate
2025-01-07 14:17:15 +08:00
..
scripts feat: add scripts to test syntax highlight (#1121) 2025-01-07 14:15:20 +08:00
tests fix: parse field access in math (#1123) 2025-01-07 14:17:15 +08:00
.gitignore feat: mark correct expression boundary on all testing files from typst/typst (#85) 2024-03-23 01:19:43 +08:00
feature.mts feat: enable experimental math syntax highlighting (#1107) 2025-01-04 05:41:57 +08:00
fenced.meta.mts docs: improve and add contribution guide for syntaxes (#471) 2024-07-27 23:04:52 +08:00
fenced.mts feat: add experimental math syntax highlighting (#1096) 2025-01-03 23:15:42 +08:00
main.mts fix: parse field access in math (#1123) 2025-01-07 14:17:15 +08:00
package.json feat: add scripts to test syntax highlight (#1121) 2025-01-07 14:15:20 +08:00
README.md chore: Fix typos throughout code base (manual) 2024-11-25 09:26:53 +08:00
textmate.mts feat: improve theme settings for raw blocks (#606) 2024-09-20 14:12:53 +08:00
tsconfig.json dev: fix errors after upgrading tsc and update resolution (#449) 2024-07-22 18:45:59 +08:00

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.