Rich text basics
Default headings, lists, tables, quotes, links, task lists, details blocks, and Markdown paste behavior in SVeditor.
Rich text basics
SVeditor is built on Tiptap / ProseMirror. The features below work without extensionsOptions. Toolbars and bubble menus ship with the SDK; you mainly control appearance and read-only mode via editable, content, and optional extensionsOptions.theme.
For persistence, see Auto-save. This page covers what you can edit and default behavior.
Included by default
These capabilities ship in the default SVeditor extension set:
| Category | Features |
|---|---|
| Blocks | Paragraphs, headings H1-H6 (StarterKit) |
| Lists | Bullet / ordered lists, task lists (with shortcut extension) |
| Tables | Resizable columns via TableKit |
| Quotes & rules | Blockquote, horizontal rule |
| Inline marks | Bold, italic, strike, underline, super/subscript |
| Color | Text color, multicolor highlight, background color |
| Layout | Font size, line height, alignment on paragraphs/headings |
| Links | Editable links (openOnClick: false by default) |
| Structural | Details collapse, highlight blocks |
| Emoji | GitHub emoji set with emoticon support |
| Markdown | Serialize / paste with GFM |
| Other | Placeholder, focus ring, typography, undo/redo |
In the auto-save demo, built-in undo/redo applies.
Integrate in your app
1. Minimal setup
import { SVeditor } from "@wztlink1013/sveditor";
import "@wztlink1013/sveditor/style.css";
SVeditor.create({
el: "#editor",
content: "<h1>Title</h1><p>Body</p>",
editable: true,
});2. Read-only preview
SVeditor.create({
el: "#preview",
content: savedHtmlOrJson,
editable: false,
});3. Typography theme (optional)
extensionsOptions.theme registers body fonts, heading colors, default code-block Shiki theme, etc. Cover and canvas metadata work with extensionsOptions.meta.
SVeditor.create({
el: "#editor",
extensionsOptions: {
theme: {
// See ThemeExtensionOptions; register custom Theme objects
},
meta: {
onFetchMeta: () => fetchMeta(docId),
onSaveMeta: (meta) => saveMeta(docId, meta),
},
},
});See also Presentation & themes.
Markdown paste
MarkdownPasteExtension converts pasted Markdown (GFM) into document structure when possible. Failures can surface through extensionsOptions.notifications (Sonner by default; see Notifications).
WeChat-rich paste can use extensionsOptions.wechatCopy alongside Markdown paste.
Common patterns
Initial content from the server
Pass JSON from a Server Component into a client host:
<SveditorMount
options={{
content: initialJsonFromServer,
extensionsOptions: {
autoSave: {
onSaveContent: (json) => save(docId, json),
},
},
}}
/>Use your client mount component (see React / Next.js).
With autoSave.onFetch, fetched content overrides static content; see Auto-save.
Restrict editing
editable: false: entire document read-only.- Route-level auth decides whether to render the editor at all.
Options
| Option | Location | Purpose |
|---|---|---|
content | EditorOptions | Initial HTML or JSON string |
editable | EditorOptions | Editability, default true |
classNames | EditorOptions | e.g. editorCore for the content area |
theme | extensionsOptions.theme | Body/heading styling |
wechatCopy | extensionsOptions.wechatCopy | WeChat rich paste handling |
Full list: EditorOptions.
Notes
- Prefer
JSON.stringify(editor.getJSON())for storage, notgetHTML(), to keep node structure (same as auto-save). - Custom nodes or disabling built-in extensions require SDK customization — not host
extensionsOptionsalone.