Function: toSafeHTML()
ts
function toSafeHTML(doc, options): string;Render a document to an HTML string without a DOM. Safe by construction: only tags produced by the schema are emitted, all text and attribute values are escaped, event-handler attributes are never written and URLs are checked again. Pass a document that went through validate(); a document that does not fit the schema throws. The same renderer as toHTML() in @writeon/html.
Parameters
| Parameter | Type |
|---|---|
doc | DocJSON |
options | ToHTMLOptions |
Returns
string
Example
ts
const html = toSafeHTML(storedDoc, { extensions })