API ReferenceCore Nodes
Heading
Block node for headings at levels 1–6 with configurable level set.
Block node for section headings at levels 1–6.
import { Heading } from '@scrivr/core';
Heading.configure({
levels: [1, 2, 3], // restrict to H1–H3 only
})Options
| Option | Type | Default | Description |
|---|---|---|---|
levels | number[] | [1,2,3,4,5,6] | Permitted heading levels. Levels outside this list are excluded from the schema. |
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
level | number | 1 | Heading level (1–6). |
align | 'left' | 'center' | 'right' | 'justify' | 'left' | Text alignment. |
fontFamily | string | null | null | Block-level font family override. |
Commands
| Command | Description |
|---|---|
setHeading1() … setHeading6() | Converts the current block to the given heading level. Only commands for configured levels are registered. |
setParagraph() | Converts the current heading back to a paragraph. |
Keyboard: Mod-Alt-1 … Mod-Alt-6 (heading), Mod-Alt-0 (paragraph)
Default styles
| Level | Font | Space before | Space after |
|---|---|---|---|
| H1 | bold 28px Georgia | 24px | 12px |
| H2 | bold 22px Georgia | 20px | 10px |
| H3 | bold 18px Georgia | 16px | 8px |
| H4 | bold 16px Georgia | 14px | 6px |
| H5 | bold 14px Georgia | 12px | 4px |
| H6 | bold 12px Georgia | 10px | 2px |
Input rules
Typing # … ###### at the start of a block converts it to the matching heading level.