Skip to content

fix(rule): report unterminated character references - #1973

Open
kudala-bharani wants to merge 1 commit into
htmlhint:mainfrom
kudala-bharani:flag-unterminated-character-references
Open

kudala-bharani wants to merge 1 commit into
htmlhint:mainfrom
kudala-bharani:flag-unterminated-character-references

Conversation

@kudala-bharani

Copy link
Copy Markdown

Short description of what this resolves

Fixes #1908. The spec-char-escape rule misses references such as &copy in HTML text, where browsers can decode them even when the terminating semicolon is missing.

Proposed changes

  • Report unterminated numeric references and named references that browsers can decode without a semicolon. Follow the HTML Standard's longest-match behavior so complete names such as ∉ and ordinary ampersands such as Q&A still pass.
  • Keep the check in HTML text and skip raw-text elements such as script and style.
  • Add regression tests and documentation examples. The rule uses a small subset of the standard's entity table and adds no runtime dependency.

npm run build, npm test -- --runInBand (397 tests), and npm run lint passed. I also checked the built bundle against all 2,125 complete named references and all 106 named references with a semicolonless form in the WHATWG table.

AI assistance

OpenAI Codex implemented the change and ran the checks.

@kudala-bharani
kudala-bharani force-pushed the flag-unterminated-character-references branch from 7baf250 to ef184a2 Compare November 26, 2026 03:59
@coliff

coliff commented Nov 26, 2026

Copy link
Copy Markdown
Member

thanks for PR - will check properly later, but can you remove the .codespellrc‎ file for now pls.

@kudala-bharani
kudala-bharani force-pushed the flag-unterminated-character-references branch from ef184a2 to 66d2507 Compare November 26, 2026 17:24

This branch has not been deployed

No deployments
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.

spec-char-escape should report unterminated html entity ("&" ampersand)

2 participants