-
Notifications
You must be signed in to change notification settings - Fork 2
Schema Reference
Jayden Smith edited this page Apr 12, 2026
·
2 revisions
The built-in schemas now include a block image node by default. The package also exports helpers for image support:
interface ImageNodeAttributes {
src: string;
alt?: string | null;
title?: string | null;
width?: number | null;
height?: number | null;
}
const IMAGE_NODE_NAME = 'image';
function imageNodeSpec(name?: string): NodeSpec;
function withImagesSchema(schema: SchemaDefinition): SchemaDefinition;
function buildImageFragmentJson(attrs: ImageNodeAttributes): DocumentJSON;interface SchemaDefinition {
nodes: NodeSpec[];
marks: MarkSpec[];
}| Field | Type | Meaning |
|---|---|---|
nodes |
NodeSpec[] |
Available node definitions. |
marks |
MarkSpec[] |
Available mark definitions. |
interface NodeSpec {
name: string;
content: string;
group?: string;
attrs?: Record<string, AttrSpec>;
role: string;
htmlTag?: string;
isVoid?: boolean;
}| Field | Type | Meaning |
|---|---|---|
name |
string |
Schema node name used in commands and JSON. |
content |
string |
Content expression string. |
group |
string | undefined |
Optional node group. |
attrs |
Record<string, AttrSpec> | undefined |
Optional attribute spec map. |
role |
string |
Semantic role understood by the Rust core. |
htmlTag |
string | undefined |
HTML tag used during HTML parsing and serialization. |
isVoid |
boolean | undefined |
Whether the node behaves as a void node. |
interface MarkSpec {
name: string;
attrs?: Record<string, AttrSpec>;
excludes?: string;
}| Field | Type | Meaning |
|---|---|---|
name |
string |
Schema mark name used by commands and JSON. |
attrs |
Record<string, AttrSpec> | undefined |
Optional attribute definitions for the mark. |
excludes |
string | undefined |
Optional exclusion string. |
interface AttrSpec {
default?: unknown;
}| Field | Type | Meaning |
|---|---|---|
default |
unknown |
Default value for the attribute when none is provided. |
Uses camelCase names.
| Kind | Names |
|---|---|
| Structural |
doc, paragraph, h1, h2, h3, h4, h5, h6, blockquote, text
|
| Lists |
bulletList, orderedList, listItem
|
| Void nodes |
hardBreak, horizontalRule, image
|
| Marks |
|---|
bold, italic, underline, strike, link
|
Uses snake_case names.
| Kind | Names |
|---|---|
| Structural |
doc, paragraph, h1, h2, h3, h4, h5, h6, blockquote, text
|
| Lists |
bullet_list, ordered_list, list_item
|
| Void nodes |
hard_break, horizontal_rule, image
|
| Marks |
|---|
bold, italic, underline, strike, link
|
Copyright © 2026 Apollo Health Group Pty. Ltd.