tiptap/packages/html/index.ts
2020-10-28 17:12:25 +01:00

11 lines
368 B
TypeScript

import { Extensions, getSchema } from '@tiptap/core'
import { Node } from 'prosemirror-model'
import getHtmlFromFragment from './getHtmlFromFragment'
export function generateHtml(doc: object, extensions: Extensions): string {
const schema = getSchema(extensions)
const contentNode = Node.fromJSON(schema, doc)
return getHtmlFromFragment(contentNode, schema)
}