add a generateJSON utility to the HTML package
This commit is contained in:
10
packages/html/src/generateHTML.ts
Normal file
10
packages/html/src/generateHTML.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Extensions, getSchema } from '@tiptap/core'
|
||||
import { Node } from 'prosemirror-model'
|
||||
import getHTMLFromFragment from './getHTMLFromFragment'
|
||||
|
||||
export default function generateHTML(doc: object, extensions: Extensions): string {
|
||||
const schema = getSchema(extensions)
|
||||
const contentNode = Node.fromJSON(schema, doc)
|
||||
|
||||
return getHTMLFromFragment(contentNode, schema)
|
||||
}
|
||||
Reference in New Issue
Block a user