feature: add generateJSON utility function to generate JSON from a HTML string

This commit is contained in:
Hans Pagel
2021-05-05 21:24:24 +02:00
parent 6f0fa6569d
commit 7feb19eb72
7 changed files with 86 additions and 1 deletions

View File

@@ -117,7 +117,11 @@ If you need to render the content on the server side, for example to generate th
Thats what the `generateHTML()` is for. Its a helper function which renders HTML without an actual editor instance.
<demo name="Guide/Content/GenerateHTML" highlight="6-7,42-48"/>
<demo name="Guide/Content/GenerateHTML" highlight="6-7,42-48" />
By the way, the other way is possible, too. The below examples shows how to generate JSON from HTML.
<demo name="Guide/Content/GenerateJSON" highlight="6,17-23"/>
## Migration
If youre migrating existing content to tiptap we would recommend to get your existing output to HTML. Thats probably the best format to get your initial content into tiptap, because ProseMirror ensures there is nothing wrong with it. Even if there are some tags or attributes that arent allowed (based on your configuration), tiptap just throws them away quietly.