Skip to content

feat: add latexOnly option to disable AsciiMath support#33

Closed
wendyyuchensun wants to merge 2 commits into
coseeing:mainfrom
wendyyuchensun:asciimath
Closed

feat: add latexOnly option to disable AsciiMath support#33
wendyyuchensun wants to merge 2 commits into
coseeing:mainfrom
wendyyuchensun:asciimath

Conversation

@wendyyuchensun
Copy link
Copy Markdown
Collaborator

@wendyyuchensun wendyyuchensun commented Apr 30, 2026

Summary

Adds a latexOnly boolean option (default false) to createMarkdownToReactParser and createTableOfContents. When true, the math extension skips AsciiMath entirely - the tokenizer regex matches only LaTeX delimiters, and backtick-delimited content is left as plain text.

Usage

Pass latexOnly: true to opt out of AsciiMath:

const parse = createMarkdownToReactParser({
  options: {
    latexDelimiter: 'bracket',
    latexOnly: true,
  },
  components,
});

// Pass the same value to createTableOfContents so heading math tokens
// are parsed consistently with the renderer
const toc = createTableOfContents(markdown, { latexOnly: true });

@wendyyuchensun wendyyuchensun force-pushed the asciimath branch 2 times, most recently from b6f714a to 956b372 Compare April 30, 2026 10:28
@wendyyuchensun
Copy link
Copy Markdown
Collaborator Author

先關掉,明天會另外按照新討論重發一條。
https://coseeing.slack.com/archives/C0AB10CARU3/p1777559989988339?thread_ts=1777528249.059519&cid=C0AB10CARU3

@wendyyuchensun wendyyuchensun deleted the asciimath branch April 30, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant