Server-Side
Server-side rendering.
在服务器环境中使用 Plate
Plate 可以在服务器端环境中使用,实现无需浏览器的内容操作。这对于生成静态内容、在服务器上处理编辑器内容或使用 React Server Components 等场景特别有用。
创建服务器端编辑器
要在服务器上使用 Plate,你可以使用 createSlateEditor
函数。这允许你在没有 DOM 环境的情况下创建和操作 Slate 文档。
示例:在 React Server Component 中生成 Markdown
这是 Plate 在 React Server Component 中从 Slate 值生成 Markdown的输出:
Blocks
Easily create headings of various levels, from H1 to H6, to structure your content and make it more organized.
Create blockquotes to emphasize important information or highlight quotes from external sources.
javascript1// Use code blocks to showcase code snippets 2function greet() { 3 console.info('Hello World!'); 4}
Marks
Add style and emphasis to your text using the mark plugins, which offers a variety of formatting options.
Make text bold, italic, underlined, or apply a combination of these styles for a visually striking effect.
Add strikethrough to indicate deleted or outdated content.
Write code snippets with inline code
formatting for easy readability.