2020-09-24 06:29:05 +08:00
|
|
|
import { Node } from 'prosemirror-model'
|
2020-09-03 22:22:08 +08:00
|
|
|
import getSchema from './getSchema'
|
2020-10-29 00:20:38 +08:00
|
|
|
import getHTMLFromFragment from './getHTMLFromFragment'
|
2021-06-18 05:41:42 +08:00
|
|
|
import { Extensions, JSONContent } from '../types'
|
2020-09-03 22:22:08 +08:00
|
|
|
|
2021-06-18 05:41:42 +08:00
|
|
|
export default function generateHTML(doc: JSONContent, extensions: Extensions): string {
|
2020-09-04 19:06:54 +08:00
|
|
|
const schema = getSchema(extensions)
|
|
|
|
const contentNode = Node.fromJSON(schema, doc)
|
2020-09-03 22:22:08 +08:00
|
|
|
|
2021-09-29 03:34:57 +08:00
|
|
|
return getHTMLFromFragment(contentNode.content, schema)
|
2020-09-03 22:22:08 +08:00
|
|
|
}
|