Skip to content

Export modules useful for HTML processing#758

Merged
claytongentry merged 1 commit intomasterfrom
claytongentry/export-html-processing-modules
Sep 22, 2021
Merged

Export modules useful for HTML processing#758
claytongentry merged 1 commit intomasterfrom
claytongentry/export-html-processing-modules

Conversation

@claytongentry
Copy link
Member

@claytongentry claytongentry commented Sep 22, 2021

Very similar to #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:

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')

@claytongentry claytongentry merged commit 9fb972e into master Sep 22, 2021
@claytongentry claytongentry deleted the claytongentry/export-html-processing-modules branch November 16, 2021 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants