escapeHtml
escapeHtml(
value):string
Defined in: packages/core/src/utils/html.ts:42
Escape a value for interpolation into HTML, in text or attribute position.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | unknown |
Returns
Section titled “Returns”string
Remarks
Section titled “Remarks”Quotes are escaped, so the result is safe inside attr="..." and
attr='...' as well as between tags. A single regex pass avoids the
double-escaping bug that chained .replace() calls hit when & is not
handled first.
Works without a DOM, so it is usable during SSR and in Node — the
document.createElement trick it replaces was not.