SeaDoc Document Model¶
This page describes the SeaDoc document format, node hierarchy, and element types. Follow the links to individual node pages for detailed data structures.
Document Format¶
SeaDoc documents stored on disk use format_version: 4 and have the following structure:
{
"version": 1,
"format_version": 4,
"elements": [],
"last_modify_user": "user@example.com"
}
All four fields are required:
version: document revision number.format_version: document format version, currently4.elements: list of top-level element nodes.last_modify_user: last modifying user, or an empty string when no user is available.
cursors belongs to runtime collaboration responses and is not stored in the .sdoc file.
Node Structure¶
A SeaDoc document is a tree with three node categories:
- Document root: the document itself, containing top-level element nodes in its
elementsproperty. - Element nodes: containers holding other element nodes or text nodes in their
childrenproperty. - Text nodes: leaf nodes containing text content and optional formatting marks.
Every element and text node requires a non-empty string id that is unique within the document. Consumers must not require a particular UUID or slug format.
Element Nodes¶
Element nodes can be block elements, which form separate blocks of content, or inline elements, which flow with text inside a block. Both groups include non-void and void elements.
All element nodes, including void and non-void elements, have:
id(required, string): unique node identifier.type(required, string): element type.children(required, array): child nodes.
Element-specific fields, including any data object, are documented on the corresponding element pages.
Non-Void Elements¶
Non-void elements expose their child content for editing. Examples include:
- Block elements:
paragraphandblockquote. - Inline elements:
link.
Void Elements¶
Void elements are treated as a single unit rather than exposing their children as editable text. Examples include:
Block and inline void elements still have children. Most, including block void elements and inline images, contain an empty text leaf as a structural placeholder, with visible content stored in element properties. File links and SeaDoc links can retain their display names in text children. Those stored labels are not editable child content; void elements do not require every persisted text child to be empty.
For example, a divider has the following structure:
{
"id": "element-id",
"type": "divider",
"children": [
{
"id": "placeholder-id",
"text": ""
}
]
}
Text Nodes¶
A text leaf has:
id(required, string): unique node identifier.text(required, string): displayed text.
Text leaves do not require type or children. For example:
{
"id": "text-id",
"text": "Text content"
}
See Text for the full text node documentation, including supported formatting marks.
Element Types¶
The following element types are documented here. Some types share a reference page. Existing SeaDoc implementations may support additional types.