Escape ampersands, angle brackets, quotes, and forward slashes as HTML entities.
This performs character escaping only. It does not sanitize arbitrary HTML, validate URLs, or make every HTML, JavaScript, or CSS context safe.
Usage:
import { escapeHTML } from "mazey";const ret = escapeHTML("<div>hello world</div>");console.log(ret); Copy
import { escapeHTML } from "mazey";const ret = escapeHTML("<div>hello world</div>");console.log(ret);
Output:
<div>hello world</div> Copy
<div>hello world</div>
The string to escape.
The escaped string.
Escape ampersands, angle brackets, quotes, and forward slashes as HTML entities.
This performs character escaping only. It does not sanitize arbitrary HTML, validate URLs, or make every HTML, JavaScript, or CSS context safe.
Usage:
Output: