Switch language한국어
Back to the list

Your LLM Writes \(x\), Your Markdown Parser Wants $x$

TL;DR AI

Key summary

2 min read
  1. A developer built Markdown math support for TeX-style inline and display delimiters emitted by LLMs, such as \(\) and \[\].

  2. The problem was that most Markdown math plugins assume dollar-sign delimiters, so LLM output often broke parsing.

  3. Regex-based delimiter swapping proved brittle around code spans, escaped punctuation, TeX commands, and truncated streaming text.

  4. The fix was added in the micromark tokenizer, then released as micromark-extension-math-extended and remark-math-extended.

  5. This makes Markdown pipelines and tools like KaTeX handle LLM-generated math more reliably, especially in streaming workflows.

Read the original