Add LaTeX math support to markdown rendering - #42
Open
tlehman wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Renders LaTeX math in the viz-app markdown pipeline via KaTeX.
$…$and\(…\). Code spans are skipped verbatim, so`$5 and $7`stays literal; unpaired delimiters and prose like "$5 to $10" stay literal too.\$is an escaped literal dollar.$$…$$and\[…\], either on one line or spanning several. Checked before fences/lists so a line starting with$$never falls through to paragraph text; an unterminated block still renders what it collected.throwOnError: false— one bad formula renders as KaTeX's error markup instead of taking down the document.The viewer is a single-file page, so KaTeX's stylesheet is inlined with its woff2 faces as data URIs; the woff/ttf fallbacks (same glyphs, ~4x the bytes) are dropped.
Test plan
viz-app/markdown.test.tsadds coverage for inline/display delimiters, code-span and currency false positives, escaped dollars, and unterminated blocks.🤖 Generated with Claude Code
https://claude.ai/code/session_01U3GB2wFs7izFyFGjPmYnMQ