Scrivr
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

OptionTypeDefaultDescription
levelsnumber[][1,2,3,4,5,6]Permitted heading levels. Levels outside this list are excluded from the schema.

Attributes

AttributeTypeDefaultDescription
levelnumber1Heading level (1–6).
align'left' | 'center' | 'right' | 'justify''left'Text alignment.
fontFamilystring | nullnullBlock-level font family override.

Commands

CommandDescription
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-1Mod-Alt-6 (heading), Mod-Alt-0 (paragraph)


Default styles

LevelFontSpace beforeSpace after
H1bold 28px Georgia24px12px
H2bold 22px Georgia20px10px
H3bold 18px Georgia16px8px
H4bold 16px Georgia14px6px
H5bold 14px Georgia12px4px
H6bold 12px Georgia10px2px

Input rules

Typing # ###### at the start of a block converts it to the matching heading level.

On this page