@mocanvas/mocanvas · function

renderHtmlFromRichText

declare function renderHtmlFromRichText(editor: Editor, richText: RichTextSource): string

A rich-text document as HTML.

Safe to hand to innerHTML: text is escaped and link hrefs are scheme-checked on the way out. Useful for rendering a label outside the canvas, and for exporting a document to somewhere that speaks HTML.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.