Skip to content

fix(meta-fetcher): decode HTML4 named entities - #397

Closed
SatriaBagusNurhadianto wants to merge 1 commit into
codercops:devfrom
SatriaBagusNurhadianto:fix/html-entity-decoding
Closed

SatriaBagusNurhadianto wants to merge 1 commit into
codercops:devfrom
SatriaBagusNurhadianto:fix/html-entity-decoding

Conversation

@SatriaBagusNurhadianto

Copy link
Copy Markdown

What changed:

  • Moved the named-entity table into src/lib/html-entities.ts and expanded it to cover HTML4 named entities.
  • Updated decodeEntities regex to match entity names containing digits ([a-z][a-z0-9]*), so ½ and ² decode.
  • Kept Object.hasOwn lookup for case-sensitive, prototype-safe decoding.

Why:

  • Previously only ten named entities were known, so typographic and accented entities reached the preview checker as raw text.

Tests:

  • npm run test (meta-fetcher suite, 54 tests) passes.
  • npm run build succeeds.

Related: #396

@bhushan4work

Copy link
Copy Markdown
Collaborator

@SatriaBagusNurhadianto please read the contributing guidelines before opening a pr , u should get urself assigned first before writing a fix, dont spam prs. comment on the issue and wait to get assigned first , closing this u may reopen once u get assigned .

@anurag629 anurag629 added the spam Low-effort or spam PR, does not count for Hacktoberfest label Nov 6, 2026
@anurag629

Copy link
Copy Markdown
Member

Thanks @SatriaBagusNurhadianto. #396 wasn't assigned to you when you opened this, so per the Spam section of CONTRIBUTING.md this one gets the spam label. That counts as a strike, your first one. #396 is still free, so if you want it, comment there and I'll assign it. Keep in mind it asks for the 252 HTML 4 names rather than HTML5's full list of over 2,000 (this table has 2,125), plus a test that fails on the current code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spam Low-effort or spam PR, does not count for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants