Repository navigation
Render LaTeX math inside live preview tables - #524
Merged
Merged
Conversation
Extract the delimiter scanner from parseMathRanges into findMathRanges so content rendered outside the document flow, such as table cells, can reuse the exact same rules.
Table cells now recognize formulas with the same delimiter rules as the rest of the note. Code spans, wikilinks and URLs keep their dollars literal, bold and highlights may wrap whole formulas but never cut through one, and `\|` reads as a literal pipe inside a formula, as GFM requires for cells.
Check that table formulas stay inside their cells, keep the text baseline, scroll when wide and show errors in both themes. Document pipes, formatting and editing for formulas in tables.
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.
Markdown live preview now renders inline
$…$and display$$…$$formulas inside table cells, closing the scope gap left by #496. Frontmatter and the rest of the note keep their current behavior.How it works
Tables are rendered by a block widget that replaces their source, so the document-level math ranges still exclude
Tablenodes. Instead:b3160097): the delimiter loop inparseMathRangesis extracted intofindMathRanges(text, excluded). Table cells use exactly the same rules as the rest of the note: escaped\$,$$$runs, prices such as$20 and $30, and no whitespace after the opener. Document behavior is unchanged.6d02c9eb): each text segment of a cell is scanned with code spans excluded. Wikilinks and URLs are already split out and keep their dollars literal. Formulas render through the existingrenderMath, so KaTeX options and error handling are shared. The widget only re-renders when the table source changes.Behavior in cells
|always ends a cell, even inside a formula.\|reads as a literal|inside a formula; use\lvert/\rvertor\vertfor bars and\Vertfor a double bar.**$x$ text**,==$x$==). Formatting that cuts through a formula or sits inside one stays literal, matching the rest of the editor.$$x$$in a cell uses display-style notation within the line.Validation
tsc(app and vitest configs) and ESLint on changed files passed.docs/markdown-math.md(f94e9ae6).Out of scope
\(…\)/\[…\]delimiters.[[Note\|alias]]) appear to keep the backslash in their target. This PR does not change that.