@lpm.dev/neo.markdown

Pool

markdown

Modern, tree-shakeable markdown parser with TypeScript support

install @lpm.dev/neo.markdown
189 exportsTypeScript

escapeHtml

function

@lpm.dev/neo.markdown@lpm.dev/neo.markdown/sanitized

function escapeHtml(html: string): string

Escape HTML entities to prevent XSS

Parameters

htmlstringHTML string to escape

Returns

stringEscaped HTML string

Example

escape('<script>alert("XSS")</script>')
// => '&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;'