gstack/make-pdf/test
Mars Huang 77067ee803 fix(make-pdf): stop URLs from swallowing smartypants placeholders
URL_RE (/\bhttps?:\/\/\S+/g) is carved after TAG_RE, but the placeholder
TAG_RE leaves behind (\u0000SMARTPANTS_PRESERVED_N\u0000) contains no
whitespace. A URL sitting flush against a tag therefore matches the URL
plus the following placeholder:

  <p>see <a href="https://ex.com">https://ex.com</a> ok</p>

carves to `...PH_1https://ex.comPH_2 ok...`, and \S+ grabs
`https://ex.comPH_2`. Restore is a single pass, so the nested PH_2 never
restores: the literal text SMARTPANTS_PRESERVED_2 renders in the PDF and
the `</a>` is gone, leaving an unclosed anchor that bleeds link-blue
through every following paragraph until some later `</a>` closes it. A
bold URL swallows `</a></strong>` and leaks bold too.

Exclude the sentinel from URL_RE so carved placeholders survive.

The existing "does NOT touch URLs" test missed this because its URL is
followed by a space, not a tag.

Fixes #2084

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 11:06:19 +08:00
..
e2e v1.58.0.0 feat: diagram + multi-format document engine (mermaid, excalidraw, single-file HTML, DOCX) (#1990) 2026-06-12 15:38:53 -07:00
fixtures v1.58.0.0 feat: diagram + multi-format document engine (mermaid, excalidraw, single-file HTML, DOCX) (#1990) 2026-06-12 15:38:53 -07:00
browseClient.test.ts v1.30.0.0 fix wave: 21 community PRs + Windows CI extension + codex flag-semantics smoke (#1391) 2026-05-09 08:06:47 -07:00
coverage-gaps.test.ts v1.58.0.0 feat: diagram + multi-format document engine (mermaid, excalidraw, single-file HTML, DOCX) (#1990) 2026-06-12 15:38:53 -07:00
diagram-prepass.test.ts v1.58.0.0 feat: diagram + multi-format document engine (mermaid, excalidraw, single-file HTML, DOCX) (#1990) 2026-06-12 15:38:53 -07:00
image-policy.test.ts v1.58.0.0 feat: diagram + multi-format document engine (mermaid, excalidraw, single-file HTML, DOCX) (#1990) 2026-06-12 15:38:53 -07:00
pdftotext.test.ts v1.30.0.0 fix wave: 21 community PRs + Windows CI extension + codex flag-semantics smoke (#1391) 2026-05-09 08:06:47 -07:00
render.test.ts fix(make-pdf): stop URLs from swallowing smartypants placeholders 2026-07-16 11:06:19 +08:00