Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export modules useful for HTML processing #758

Merged
merged 1 commit into from
Sep 22, 2021

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