garrytan / garrytan/gstack

make-pdf: bare/visible http(s):// URLs become SMARTPANTS_PRESERVED tokens and bleed link-blue into the rest of the doc

Open
#2,084 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
133k
Forks
19.9k
Avg merge
18h 46m
Merged PRs (30d)
26

Description

## Summary

`make-pdf generate` mangles any bare/visible `http(s)://` URL into literal `SMARTPANTS_PRESERVED_` tokens, and leaves an unclosed `` that bleeds link-blue into **every following block** for the rest of the document.

Version: gstack `1.55.0.0` (binary `make-pdf/dist/pdf`).

## Repro

```markdown
# t

See https://example.com here.

This paragraph after the URL should be black.
```

```bash
make-pdf generate /tmp/ex.md /tmp/ex.pdf
```

## Actual

- URL renders as `https://example.comSMARTPANTS_PRESERVED_4 here.` (the smartypants protect-placeholder is never restored).
- The next paragraph ("This paragraph after the URL should be black.") renders **blue/underlined** — the broken `
` is never closed, so link styling bleeds into all subsequent blocks (headings + body) to the end of the doc.

## Expected

URL renders intact as a clickable link; following content keeps its normal (black) styling.

## Scope / triggers

Reproduces whenever a raw URL is **visible text**, in any of:
- bare URL (`https://example.com`), line-end or mid-line
- bold (`**https://example.com**`)
- markdown link whose **display text is also a URL** (`[https://example.com](https://example.com)`)

Only clean case: markdown link with non-URL display text → `[example](https://example.com)`. That suggests the smartypants/typography pre-pass tokenizes the URL to protect it, then fails to restore the placeholder when the visible run is itself a URL.

## Workaround

Use `[label](https://…)` with non-URL display text, or drop the `://` scheme and write the host as plain text. Posting in case the protect/restore step is an easy fix.

Contributor guide

Open the contributing guide

Research direction

Start by running the provided Markdown reproduction with `make-pdf generate` and inspect the `make-pdf/dist/pdf` implementation around its smartypants/typography pre-pass and protect/restore handling. Done means visible raw URLs render as intact clickable links and the paragraph after each URL retains normal black styling, including the listed bold and markdown-link cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.