gstack/make-pdf/src
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
..
browseClient.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
cli.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
commands.ts feat(v1.4.0.0): /make-pdf — markdown to publication-quality PDFs (#1086) 2026-04-20 13:20:30 +08:00
diagram-prepass.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.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-size.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
orchestrator.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.ts v1.52.2.0 fix(make-pdf): render emoji instead of tofu (▯) on Linux (#1787) 2026-05-29 18:06:19 -07:00
print-css.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
render.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
setup.ts feat(v1.4.0.0): /make-pdf — markdown to publication-quality PDFs (#1086) 2026-04-20 13:20:30 +08:00
smartypants.ts fix(make-pdf): stop URLs from swallowing smartypants placeholders 2026-07-16 11:06:19 +08:00
types.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