2020-09-03 22:22:08 +08:00
|
|
|
import getSchema from './getSchema'
|
2020-09-04 19:06:54 +08:00
|
|
|
import getHtmlFromFragment from './getHtmlFromFragment'
|
|
|
|
import { Node, DOMSerializer } from 'prosemirror-model'
|
2020-09-04 17:59:09 +08:00
|
|
|
import { Extensions } from '../types'
|
2020-09-03 22:22:08 +08:00
|
|
|
|
2020-09-04 19:06:54 +08:00
|
|
|
export default function generateHtml(doc: object, extensions: Extensions): string {
|
|
|
|
const schema = getSchema(extensions)
|
|
|
|
const contentNode = Node.fromJSON(schema, doc)
|
2020-09-03 22:22:08 +08:00
|
|
|
|
2020-09-04 19:06:54 +08:00
|
|
|
return getHtmlFromFragment(contentNode, schema)
|
2020-09-03 22:22:08 +08:00
|
|
|
}
|