mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-29 12:57:09 -06:00
* Math: bound the depth the equation parsers build (#1456) x^1^1^1…, a/a/a… and \sum\sum… built left-nested trees thousands of levels deep within the input cap; clean, Clone, PartialEq, Drop and serde then overflowed small stacks. Wrapping an existing node (script base, numerator, accent, limit base, n-ary body) is skipped once it is already 32 levels deep (iterative check); the operator is text (linear) or dropped (LaTeX). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Math: escape \text{…} in LaTeX output so it reads back unchanged (#1456) Normal-text runs were written verbatim, so a}b\c became \text{a}b\c} and read back as ab\c. Escape \ { } % $ # & _ ~ (backslash as \backslash{}); \backslash is now a named symbol and raw_arg ignores the empty braces after a control word. A # inside normal text no longer numbers the equation. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Math: merge runs inside every structure, not just some (#1456) merge_runs only recursed into fractions, scripts, radicals, n-ary operators, delimiters and functions, so the LaTeX parser left \overline{ab} as two runs where the linear parser gives one. It now recurses through map_args for every node kind. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>