With these three modules working together, I can process HTML to Mobiledoc with the following pattern:
import { DOMParser, PostNodeBuilder as Builder, Renderer } from 'mobiledoc-kit'
import { JSDOM } from 'jsdom'
const html = "<h1>Hello, world</h1>"
const dom = new JSDOM(html)
const parser = new DOMParser(new Builder())
const post = parser.parse(dom.window.document.body)
Renderer.render(post, '0.3.2')
Very similar to https://github.com/bustle/mobiledoc-kit/pull/755, but I thought
Renderer
is perhaps more in keeping with the pattern of these exports.With these three modules working together, I can process HTML to Mobiledoc with the following pattern: