Scrivr
GuidesNodes & Extensions

Built-in Nodes

Complete reference for all extensions bundled with @scrivr/core.

All extensions are exported from @scrivr/core and aggregated by StarterKit. You can use StarterKit for convenience, or compose individual extensions to include only what you need.


Block Nodes

Paragraph

The default block type. Every document must include Paragraph.

import { Paragraph } from '@scrivr/core';

No configurable options.


Heading

Block node for headings at levels 1–6.

import { Heading } from '@scrivr/core';

Heading.configure({
  levels: [1, 2, 3], // restrict to H1–H3 only
})
OptionTypeDefaultDescription
levelsnumber[][1,2,3,4,5,6]Permitted heading levels.

Commands: setHeading1()setHeading6() (only levels in options.levels are registered), setParagraph()


List

Provides both bullet and ordered lists, including listItem.

import { List } from '@scrivr/core';

No configurable options.

Commands: toggleBulletList(), toggleOrderedList(), liftListItem(), sinkListItem()


CodeBlock

Fenced code block with monospace rendering.

import { CodeBlock } from '@scrivr/core';

No configurable options.

Commands: toggleCodeBlock()


HorizontalRule

A thematic break — renders as a horizontal line.

import { HorizontalRule } from '@scrivr/core';

No configurable options.

Commands: setHorizontalRule()


Inline Nodes

Image

Inline image node with support for float layout modes.

import { Image } from '@scrivr/core';

Attributes: src, alt, title, width, height, floatMode ('inline' | 'square-left' | 'square-right' | 'top-bottom' | 'behind' | 'front')

Commands: insertImage({ src, alt?, width?, height? })


Marks

Bold

import { Bold } from '@scrivr/core';

Commands: toggleBold() Keyboard: Mod-b


Italic

import { Italic } from '@scrivr/core';

Commands: toggleItalic() Keyboard: Mod-i


Underline

import { Underline } from '@scrivr/core';

Commands: toggleUnderline() Keyboard: Mod-u


Strikethrough

import { Strikethrough } from '@scrivr/core';

Commands: toggleStrikethrough()


Highlight

Background highlight. Supports multiple colours.

import { Highlight } from '@scrivr/core';

Highlight.configure({
  colors: ['#fef08a', '#bbf7d0', '#bfdbfe'], // allowed colours
})
OptionTypeDefaultDescription
colorsstring[]Yellow, green, bluePermitted highlight colours.

Commands: toggleHighlight({ color }), unsetHighlight()


Color

Text foreground colour.

import { Color } from '@scrivr/core';

Color.configure({
  colors: ['#dc2626', '#2563eb', '#16a34a'],
})
OptionTypeDefaultDescription
colorsstring[]Common palettePermitted text colours.

Commands: setColor(color), unsetColor()


FontSize

Text size in pixels.

import { FontSize } from '@scrivr/core';

FontSize.configure({
  sizes: [10, 12, 14, 16, 18, 24, 32],
})
OptionTypeDefaultDescription
sizesnumber[]Common scalePermitted font sizes in px.

Commands: setFontSize(size), unsetFontSize()


FontFamily

Text font family.

import { FontFamily } from '@scrivr/core';

FontFamily.configure({
  families: ['Arial', 'Georgia', 'Courier New'],
})
OptionTypeDefaultDescription
familiesstring[]Common system fontsPermitted font families.

Commands: setFontFamily(family), unsetFontFamily()


Hyperlink mark.

import { Link } from '@scrivr/core';

Attributes: href, title

Commands: setLink({ href, title? }), unsetLink()


Behaviour Extensions

Alignment

Paragraph text alignment (left, center, right, justify).

import { Alignment } from '@scrivr/core';

Commands: setAlignment('left' | 'center' | 'right' | 'justify')


History

Undo/redo stack powered by ProseMirror's history module.

import { History } from '@scrivr/core';

History.configure({
  depth: 100,   // max undo steps
  delay: 500,   // ms — events within this window are merged into one step
})
OptionTypeDefaultDescription
depthnumber100Maximum number of undo steps.
delaynumber500Events within this many ms are merged into one history entry.

Commands: undo(), redo() Keyboard: Mod-z (undo), Mod-Shift-z / Mod-y (redo)


Pagination

Enables multi-page layout. Required for the canvas layout engine to split content across pages. Included in StarterKit automatically.

import { Pagination } from '@scrivr/core';

Typography

Smart typography rules — converts "straight quotes" to "curly quotes", -- to em-dashes, etc.

import { Typography } from '@scrivr/core';

TrailingNode

Ensures the document always ends with an empty paragraph, preventing cursor trapping at the last block node.

import { TrailingNode } from '@scrivr/core';

On this page