Skip to main content

Crate html_entity_fix

Crate html_entity_fix 

Source
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("&lt;tag&gt;"), "<tag>");
assert_eq!(fix("&#39;hello&#39;"), "'hello'");

Functions§

fix
Decode named and numeric HTML entities in s. Unknown entities are passed through unchanged.