fix: Skip math content in tables rule to preserve LaTeX escape sequences (#11134)

Fixes #10255 where LaTeX commands containing \n (like \neg, \neq, \nu)
were being incorrectly interpreted as newline characters when pasted.

The tables rule was processing all inline content and splitting on \n
sequences, which broke LaTeX math expressions. This fix skips processing
for math_inline tokens, similar to the existing skip for code_inline.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Tom MoorandClaude Sonnet 4.5 authored and GitHub committed 2026-01-10 12:29:47 -05:00
1 parent 6c3a0f7cb3
commit ae59a8b25e
1 file changed
+6
+6
View File
@@ -24,6 +24,12 @@ export default function markdownTables(md: MarkdownIt): void {
tokens[i].children = [];
existing.forEach((child) => {
// Skip processing math content to preserve LaTeX escape sequences
if (child.type === "math_inline") {
tokens[i].children?.push(child);
return;
}
let content = child.content;
// First handle <br> tags