Skip to content

Stop bare URLs at curly quotes in the page renderer - #287

Merged
TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/bare-url-curly-quotes
Nov 10, 2026
Merged

TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/bare-url-curly-quotes

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Problem

An evidence note that quotes a URL in curly quotes publishes a dead link. On the live entry/game-icons-net/ page the note

suggested mention “Icons made by {author}. Available on https://game-icons.net”

renders as

<a href="https://game-icons.net”" rel="noopener noreferrer">https://game-icons.net”</a>

so the browser resolves the host game-icons.xn--net-9o0a, which does not exist (DNS ENOTFOUND). #274 fixed the same quote problem in the link checker's evidenceUrls, so the checker and the renderer now disagree on where a URL ends.

Root cause

The bare-URL regex in site/lib/markdown.mjs stops at a straight " but not at the curly quotes ‘ ’ “ ”, while evidenceUrls() in site/lib/link-check.mjs excludes them.

Fix

Add ‘ ’ “ ” to the excluded character class, matching evidenceUrls, with a comment pointing at #274 and #285. No other behaviour changes: the closing quote now stays outside the <a>.

Testing

  • Two new renderInline assertions in site/lib/lib.test.mjs (on “https://a.test/x” and see ‘https://a.test/y’) require the URL alone inside the link with the quote outside. Both fail against the old regex and pass with the change.
  • npm test: checks.test ok: 274 assertions across 34 checks, lib.test ok: 1700 assertions in 74 sections.
  • npm run lint: 66 scripts parse, no unused imports.
  • npm run build: 422 entries built; site/dist/entry/game-icons-net/index.html now has three href="https://game-icons.net" links and no href containing a curly quote.

Type

  • Docs or site

Fixes #285

The bare-URL autolinker stopped at a straight quote but not at a curly
one, so an evidence note that quoted a URL published the closing quote
as part of the href: https://game-icons.net” resolved to a host that
does not exist. The link check already ends URLs at curly quotes (TMHSDigital#274),
so the checker and the renderer disagreed on where a URL ends.

Add ‘ ’ “ ” to the excluded characters, matching evidenceUrls, and cover
both quote styles with renderInline tests.

Fixes TMHSDigital#285
@TMHSDigital
TMHSDigital merged commit 1bcc458 into TMHSDigital:main Nov 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bare-URL autolinks keep a closing curly quote, publishing a dead link on game-icons-net

2 participants