Release v2.0.27: Guard optional host pypdf/reportlab in test_core_suite.py and ignore math-mode | bars in _split_markdown_table_row

This commit is contained in:
Hermes Agent committed 2026-11-30 21:51:10 +00:00
1 parent 055e215090
commit 36867a4ff8
23 files changed
+69 -64

No files matched your search

@@ -120,7 +120,7 @@ def _transpile_latex_segment(seg: str) -> str:
def _split_markdown_table_row(line: str) -> list[str]:
"""
Split a Markdown table row `| a | b | c |` ONLY on unescaped `|` characters that are
outside backtick `` `...` `` spans and HTML entities (`|`).
outside backtick `` `...` `` spans, inline `$...$` math spans, and HTML entities (`|`).
"""
inner = line.strip()
if inner.startswith("|"):
@@ -131,6 +131,7 @@ def _split_markdown_table_row(line: str) -> list[str]:
cells: list[str] = []
buf: list[str] = []
in_ticks = False
in_math = False
i = 0
n = len(inner)
while i < n:
@@ -139,10 +140,14 @@ def _split_markdown_table_row(line: str) -> list[str]:
in_ticks = not in_ticks
buf.append(ch)
i += 1
elif ch == "$" and not in_ticks and (i == 0 or inner[i - 1] != "\\"):
in_math = not in_math
buf.append(ch)
i += 1
elif ch == "\\" and i + 1 < n and inner[i + 1] == "|":
buf.append("|")
i += 2
elif ch == "|" and not in_ticks:
elif ch == "|" and not in_ticks and not in_math:
cells.append("".join(buf).strip())
buf = []
i += 1