tiptap/packages/core/src/utils/generateHtml.ts

12 lines
397 B
TypeScript
Raw Normal View History

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