Simple Entity Decode
A tiny library to decode HTML numeric entities and basic XML named entities.
Most entity libraries include complex handling for entities, and include the full list of named entities from the HTML specification. However, most applications and pages don't need this, and can instead normalise entities (e.g. on the server).
Specifically, this library decodes:
- Basic named entities (
- Numeric decimal entities (
- Numeric hexadecimal entities (
It does not handle other named entities. Instead, normalise the entities on the server; for example in WordPress, you can use the
import decodeEntities from 'simple-entity-decode'; decodeEntities( 'Bill & Ted’s Excellent Adventure' ); // → "Bill & Ted’s Excellent Adventure"
Copyright 2019 Human Made. Licensed under the MIT license.
Uses code from he by Mathias Bynens. Used under the MIT license.