tiptap/packages/core/src/helpers/generateHTML.ts

13 lines
424 B
TypeScript
Raw Normal View History

2020-09-24 06:29:05 +08:00
import { Node } from 'prosemirror-model'
2021-06-18 05:41:42 +08:00
import { Extensions, JSONContent } from '../types'
import { getHTMLFromFragment } from './getHTMLFromFragment'
import { getSchema } from './getSchema'
export function generateHTML(doc: JSONContent, extensions: Extensions): string {
const schema = getSchema(extensions)
const contentNode = Node.fromJSON(schema, doc)
return getHTMLFromFragment(contentNode.content, schema)
}