Overview
Thedoc extension defines the root document node that serves as the top-level container for all content in a ProseKit editor. Every editor must have exactly one doc node as its root.
Installation
Usage
API Reference
defineDoc()
Defines the document node specification. Returns:DocExtension
Type Signature:
Node Specification
The doc node is defined with the following properties:- name:
doc - content:
block+(requires at least one block-level node) - topNode:
true(indicates this is the root node)
Details
Content Model
The doc node accepts one or more block-level nodes as its children. This means you must define at least one block extension (such asparagraph, heading, or codeBlock) for your editor to function properly.
Top Node
ThetopNode: true property marks this as the root of the document tree. There can only be one top node in a schema, and it cannot be nested inside other nodes.
Examples
Basic Editor Setup
With Multiple Block Types
Related Extensions
- Paragraph - Basic text blocks
- Heading - Heading levels 1-6
- Blockquote - Quoted text blocks
- Code Block - Code snippets with syntax highlighting