tiptap/packages/html/index.ts

12 lines
402 B
TypeScript
Raw Normal View History

2020-09-04 19:44:27 +08:00
import getSchema from '@tiptap/core'
import getHtmlFromFragment from './getHtmlFromFragment'
import { Node } from 'prosemirror-model'
import { Extensions } from '@tiptap/core'
export default function generateHtml(doc: object, extensions: Extensions): string {
const schema = getSchema(extensions)
const contentNode = Node.fromJSON(schema, doc)
return getHtmlFromFragment(contentNode, schema)
}