rename demo, add more content
This commit is contained in:
@@ -1,13 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<pre>{{ html }}</pre>
|
||||||
<pre>{{ html }}</pre>
|
|
||||||
<pre>{{ otherHtml }}</pre>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { generateHTML } from '@tiptap/core'
|
import { generateHTML } from '@tiptap/html'
|
||||||
import { generateHTML as generateHTMLWithoutEditor } from '@tiptap/html'
|
|
||||||
import Document from '@tiptap/extension-document'
|
import Document from '@tiptap/extension-document'
|
||||||
import Paragraph from '@tiptap/extension-paragraph'
|
import Paragraph from '@tiptap/extension-paragraph'
|
||||||
import Text from '@tiptap/extension-text'
|
import Text from '@tiptap/extension-text'
|
||||||
@@ -26,7 +22,6 @@ export default {
|
|||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
html: '',
|
html: '',
|
||||||
otherHtml: '',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -36,12 +31,6 @@ export default {
|
|||||||
Paragraph(),
|
Paragraph(),
|
||||||
Text(),
|
Text(),
|
||||||
])
|
])
|
||||||
|
|
||||||
this.otherHtml = generateHTMLWithoutEditor(this.json, [
|
|
||||||
Document(),
|
|
||||||
Paragraph(),
|
|
||||||
Text(),
|
|
||||||
])
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -126,15 +126,13 @@ const schema = getSchema([
|
|||||||
|
|
||||||
## Generate HTML from ProseMirror JSON
|
## Generate HTML from ProseMirror JSON
|
||||||
|
|
||||||
If you need to render the content on the server side, e. g. for a blog post that was written with tiptap, you’ll probably need a way to do just that without an actual editor instance.
|
If you need to render the content on the server side, for example to render a blog post which was written with tiptap, you’ll probably need a way to do just that without an actual editor instance. That’s what `generateHTML()` is for. It’s a utility function that renders HTML without an actual editor instance.
|
||||||
|
|
||||||
That’s what `generategetHTML()` is for. It’s a utility function that renders HTML without an actual editor instance.
|
:::info Browser-only rendering
|
||||||
|
Import a lightweight implementation from `@tiptap/core` if you’re using the function in a browser context only.
|
||||||
:::warning Work in progress
|
|
||||||
Currently, that works only in the browser (client side), but we plan to bring this to Node.js (to use it on the server side).
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
<demo name="Api/Schema/GenerateHtml" highlight="6,29-33"/>
|
<demo name="Api/Schema/GenerateHTML" highlight="6,29-33"/>
|
||||||
|
|
||||||
### Converting JSON<>HTML with PHP
|
### Converting JSON<>HTML with PHP
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user