Skip to content

Commit

Permalink
feat: add experimental math syntax highlighting (#1096)
Browse files Browse the repository at this point in the history
* feat: add experimental math syntax highlighting

* dev: math identifier can be after some text brace

* dev: math identifier must contain multiple chars
  • Loading branch information
Myriad-Dreamin authored Jan 3, 2025
1 parent d7dd2f3 commit d4ba43c
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 111 deletions.
6 changes: 6 additions & 0 deletions syntaxes/textmate/feature.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Feature Flags
*/
export const SYNTAX_WITH_BOLD_ITALIC = false;
export const SYNTAX_WITH_MATH = false;
export const SYNTAX_WITH_LANGS = true;
4 changes: 2 additions & 2 deletions syntaxes/textmate/fenced.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as textmate from "./textmate.mjs";
import { languages as rawLanguages } from "./fenced.meta.mjs";
import { SYNTAX_WITH_LANGS } from "./feature.mjs";

const IDENTIFIER_BARE = /[\p{XID_Start}_][\p{XID_Continue}_\-]*/u;

Expand Down Expand Up @@ -84,8 +85,7 @@ const genLang = (
};
};

const RENDER_LANGS = true;
export const blockRawLangs = RENDER_LANGS ? rawLanguages.map(genLang) : [];
export const blockRawLangs = SYNTAX_WITH_LANGS ? rawLanguages.map(genLang) : [];

export const inlineRaw: textmate.Pattern = {
name: "markup.raw.inline.typst string.other.raw.typst",
Expand Down
Loading

0 comments on commit d4ba43c

Please sign in to comment.