Preview checker: named entities like `’` and `—` show up as raw text
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 78/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
Piste de recherche
Start with decodeEntities() and NAMED_ENTITIES in src/lib/meta-fetcher.ts, then review the existing parseMetaTags tests. Add the HTML 4 entity table in src/lib/html-entities.ts and update the entity name matching while preserving exact case and safe lookup behavior. Add a regression test for named entities with digits, then run npm run check, npm run test, and npm run build; done when the acceptance criteria pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
decodeEntities() in src/lib/meta-fetcher.ts only knows the ten names in NAMED_ENTITIES (line 190: amp, lt, gt, quot, apos, nbsp and the uppercase AMP, LT, GT, QUOT), so any other named entity reaches the preview checker as raw text. Typographic ones like ’, —, … and “ are common in titles and descriptions, and browsers show them as the characters (document.title gives Don’t ship on Fridays — notes from 200 releases | Acme Blog), but the checker keeps them:
parseMetaTags('<title>Don’t ship on Fridays — notes from 200 releases | Acme Blog</title>', 'https://example.com').title
// "Don’t ship on Fridays — notes from 200 releases | Acme Blog"
That 59-character title gets "Title is 71 chars (recommended: under 70)" from analyzeMeta(), every platform card shows the ’ and —, and the Google Search preview (resolvePlatformPreviews() in src/lib/platform-specs.ts) cuts it at 60 characters before | Acme Blog. Accented letters (é, É) and symbols (©, ™, €) stay raw the same way, and Smart Autofill (src/pages/api/ai/autofill.ts:63) hands the raw text to the model.
The regex has a second catch: it only matches names made of letters ([a-z]+), so ½, ² and the other names with digits can't decode even once they're in the table.
What to do
- Add the rest of the 252 named entities from HTML 4 (the Latin-1, symbol and special sets) to the table. That's where the typographic and accented-letter ones live, and it keeps the table to a few hundred lines instead of HTML5's full list of over 2,000. Put it in its own file, like
src/lib/html-entities.ts, someta-fetcher.tsstays readable, and keepaposand the four uppercase names that are there now. - Take the characters from the current list (https://html.spec.whatwg.org/entities.json), since a few changed after HTML 4 (
⟨and⟩are U+27E8 and U+27E9 now). - Names are case-sensitive, so keep the exact lookup (
ÉisÉ,éisé) and theObject.hasOwncheck from #391. - Let the regex match names with digits, like
[a-z][a-z0-9]*. Numeric entities already work, so leave that branch as it is.
Acceptance criteria
- The title above comes out as
Don’t ship on Fridays — notes from 200 releases | Acme Blog, and every HTML 4 named entity decodes in titles and attribute values, including½and² - Unknown names, wrong-case names like
&Amp;and&NBSP;, and prototype names like&constructor;stay as they are, and every existingparseMetaTagstest still passes - A test that fails on the current code
-
npm run check,npm run testandnpm run buildpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #NUM in the description.
- Langage dominant
- TypeScript
- Étoiles
- 8
- Forks
- 4
- Merge moyen
- 8 h 44 min
- PR mergées (30 j)
- 159
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de codercops/ogcops
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
codercops/ogcops#394 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Preview checker: a `<title>` written over several lines keeps its line break and indentationPeut-être pris @bhushan4work l’a pris il y a 1 jour. Ouvertebug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
codercops/ogcops#393 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug] “Copy Recommended Meta Tags” generates an unusable placeholder image URLPeut-être à nouveau libre @CreatorguyS l’a pris il y a 7 jours, et aucune pull request n’est ouverte. Ouvertebug enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
codercops/ogcops#378 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Add the Do and Don't tutorial template (`tutorial-do-dont`)Peut-être pris @Ravindar-Amogh-Gummadavelly l’a pris il y a 7 jours. Ouvertegood first issue templates
codercops/ogcops#355 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
codercops/ogcops#341 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de codercops/ogcops
Issues similaires
-
Difficulté 1/5 1-3 heures Accessibilité débutants 86/100
ranxianglei/billion-context#5893 ·
Les mainteneurs répondent en général sous 1 jour
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement security severity:low
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Battle-Cattle/BCUK-Bot-4#959 ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apartPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverteaccount-pool bug gui
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
lidge-jun/opencodex#8286 · 2 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour