Function: toHTML()
ts
function toHTML(doc, options): string;Render a document to an HTML string without a DOM, in the browser, in Node or during SSR. Safe by construction: only tags produced by the schema are emitted, all text and attribute values are escaped, event handlers are never written, style keeps only alignment, font family and colour declarations with strict values, and URLs are checked again. A document that does not fit the schema throws; on a server, run untrusted input through validate() from @writeon/server first.
Parameters
| Parameter | Type |
|---|---|
doc | DocJSON |
options | ToHTMLOptions |
Returns
string
Example
ts
const html = toHTML(editor.getJSON(), { extensions })