New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

html-entity-codec

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-entity-codec

Decode, encode, and escape HTML character references

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
38K
158.31%
Maintainers
1
Weekly downloads
 
Created
Source

html-entity-codec

Decode, encode, and escape HTML character references

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

No dependencies whatsoever. This package declares no dependencies or devDependencies.

Features

HTML character-reference transformations from pinned WHATWG data.

  • Decode in one pass with text or attribute context and explicit semicolon and parse-error policies.
  • Encode with stable named aliases or uppercase hexadecimal references; the dedicated numeric encoder lets bundlers omit named data.
  • Escape quoted attributes and ordinary HTML text, with optional progress and completion callbacks.
  • Keep source offsets through the reference scanner.

Install

This package is pure ESM.

npm i html-entity-codec

Quick Take

import assert from "node:assert/strict";
import { decode } from "html-entity-codec";

assert.equal(
  decode("Cat & fiddle 😼🎻"),
  "Cat & fiddle 😼🎻",
);

Documentation

Please visit codsen.com for a full description of the API. For Changelog, see raw md on GitHub or the website.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright © 2010-2026 Roy Revelt and other contributors

HTML named character references - Copyright © WHATWG (Apple, Google, Mozilla, Microsoft) - see its BSD-3-Clause disclaimer

ok codsen star

Keywords

decode

FAQs

Package last updated on 06 Sep 2026

Related posts