Serialization
Store JSON, render HTML, index plain text.
Helpers
ts
import { htmlToJSON, jsonToHTML, jsonToText } from "@tlob/babloom-core";
const doc = htmlToJSON("<p>Hello <strong>world</strong></p>");
const html = jsonToHTML(doc);
const text = jsonToText(doc);From an instance
ts
editor.getJSON(); // BabloomDoc
editor.getHTML(); // string
editor.getText(); // string
editor.isEmpty(); // boolean
editor.setContent(doc);Persist getJSON() in your database: it is stable, framework independent and safe to render on the server through jsonToHTML.