Expand description
§html-entity-fix
Decode HTML entities (&, <, >, ", ',
', etc.) inside text that was supposed to be plain.
LLMs sometimes emit HTML-escaped text into JSON or chat output — usually because they over-corrected from a prior HTML context. This crate decodes the common cases without pulling in a full HTML parser.
§Example
use html_entity_fix::fix;
assert_eq!(fix("AT&T"), "AT&T");
assert_eq!(fix("<tag>"), "<tag>");
assert_eq!(fix("'hello'"), "'hello'");Functions§
- fix
- Decode named and numeric HTML entities in
s. Unknown entities are passed through unchanged.