Files
wordcraft/crates
loganjandClaude Sonnet 5.5 9ddaff2dae Import: hostile Markdown and HTML no longer take quadratic time (#355)
A few hundred KB of `*[`, `![a](b`, `<a` or `&#` froze the importer for tens of seconds:
- Markdown rescanned the rest of the text from every unmatched `[` / `![` (and for the
  link destination), `<` (for `>`) and `&` (for `;`). Bracket and destination scans now
  share a per-paragraph look-ahead budget, tags are searched within 4 KB and entity names
  within 33 bytes.
- HTML `unescape` searched the whole remaining text for `;` after every stray `&`; it now
  looks only at the first 33 bytes.
- The Markdown/HTML-to-document step appended every inline through `insert_text`, which
  rescans all earlier runs, so a paragraph with thousands of runs took quadratic time on
  its own. It now appends runs directly and normalises once.

Ordinary links, images, tags and entities read as before.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 17:41:41 -04:00
..