Repository navigation
Conversation
This branch has not been deployed
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.
Description
decodeEntities()insrc/lib/meta-fetcher.tsonly knew ten named entities, so common ones like’,—,…,éand©reached the preview checker as raw text. That inflated title lengths (a 59-character title was reported as 71 chars), showed’and—on every platform card, made the Google preview cut titles too early, and passed raw entities to Smart Autofill.This PR:
src/lib/html-entities.tswith the 252 HTML 4 named entities (Latin-1, symbol and special sets), with characters taken from the current WHATWG list (⟨and⟩are U+27E8 and U+27E9).aposand the four uppercase names (AMP,LT,GT,QUOT) are kept.NAMED_ENTITIEStable inmeta-fetcher.tswith that import, keeping the case-sensitive exact lookup and theObject.hasOwncheck from fix(meta-fetcher): ignore Object prototype properties when decoding named entities #391.[a-z]+to[a-z][a-z0-9]*so names with digits (½,²) decode. The numeric entity branch is unchanged.&Amp;, ) and prototype names (&constructor;) are still left as they are.Closes #396
How I Tested This
tests/lib/meta-fetcher.test.ts:Don’t ship on Fridays — notes from 200 releases | Acme BlogandanalyzeMeta()no longer reports a title-length warning…,é,É,©,™,€,½,²,⟨,⟩) in attribute values<title>and a<meta>attribute valueapos+ 4 uppercase)&EACUTE;and&Frac12;stay raw)meta-fetcher.tschange) and pass with the fix.html-entities.tsagainsthttps://html.spec.whatwg.org/entities.jsonwith a temporary script (not committed). <result: e.g. "no mismatches">parseMetaTagsexample returnedDon’t ship on Fridays — notes from 200 releases | Acme Blog. After, it returnsDon’t ship on Fridays — notes from 200 releases | Acme Blog.npm run check,npm run testandnpm run build: <paste result, e.g. "all pass">AI Assistance
Claude helped me with a first draft of
html-entities.tsand the tests, and debugging. I reviewed the code, verified the entity table against the WHATWGentities.json, and ran the tests and checks myself.Type of Change
Checklist
devnpm run checkpassesnpm run testpassesnpm run dev