Repository navigation
Stop bare URLs at curly quotes in the page renderer - #287
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An evidence note that quotes a URL in curly quotes publishes a dead link. On the live
entry/game-icons-net/page the noterenders as
so the browser resolves the host
game-icons.xn--net-9o0a, which does not exist (DNSENOTFOUND). #274 fixed the same quote problem in the link checker'sevidenceUrls, so the checker and the renderer now disagree on where a URL ends.Root cause
The bare-URL regex in
site/lib/markdown.mjsstops at a straight"but not at the curly quotes‘ ’ “ ”, whileevidenceUrls()insite/lib/link-check.mjsexcludes them.Fix
Add
‘ ’ “ ”to the excluded character class, matchingevidenceUrls, with a comment pointing at #274 and #285. No other behaviour changes: the closing quote now stays outside the<a>.Testing
renderInlineassertions insite/lib/lib.test.mjs(on “https://a.test/x”andsee ‘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.htmlnow has threehref="https://game-icons.net"links and no href containing a curly quote.Type
Fixes #285