Skip to content

Blockquote

The Blockquote node provides a block-level quote container (<blockquote>). Blockquotes can hold one or more block nodes (paragraphs, headings, lists, etc.) and support nesting. A markdown-style input rule (> + space) and a keyboard shortcut (Mod-Shift-B) are included.

Type > + space at the start of a line to create a blockquote. Use Mod-Shift-B to toggle.

Click to try it out

Blockquote is included in StarterKit. If you are building a custom setup without StarterKit, add it manually:

import { Editor, Document, Text, Paragraph, Blockquote } from '@domternal/core';
const editor = new Editor({
element: document.getElementById('editor')!,
extensions: [Document, Text, Paragraph, Blockquote],
content: '<blockquote><p>A wise quote</p></blockquote>',
});
PropertyValue
ProseMirror nameblockquote
TypeNode
Groupblock
Contentblock+ (one or more block nodes)
DefiningYes
HTML tag<blockquote>

The content expression block+ means a blockquote must contain at least one block node. You can nest paragraphs, headings, lists, code blocks, or even other blockquotes inside it.

The defining property means that when you select a blockquote and paste content over it, the replacement keeps the blockquote wrapper rather than converting to the pasted node type.

OptionTypeDefaultDescription
HTMLAttributesRecord<string, unknown>{}HTML attributes added to the blockquote element
import { Blockquote } from '@domternal/core';
const CustomBlockquote = Blockquote.configure({
HTMLAttributes: { class: 'my-quote' },
});
CommandDescription
setBlockquote()Wrap the current selection in a blockquote
toggleBlockquote()Toggle blockquote wrapping on the current selection
unsetBlockquote()Remove the blockquote wrapping (lift content out)
// Wrap selection in a blockquote
editor.commands.setBlockquote();
// Toggle blockquote on/off
editor.commands.toggleBlockquote();
// Remove blockquote
editor.commands.unsetBlockquote();
// With chaining
editor.chain().focus().toggleBlockquote().run();

setBlockquote wraps the selected blocks inside a <blockquote>. toggleBlockquote removes the wrapper if the selection is already inside a blockquote. unsetBlockquote always lifts the content out of the nearest blockquote.

ShortcutCommand
Mod-Shift-BtoggleBlockquote()

Blockquote does not register custom Backspace or Enter handlers. Standard ProseMirror behavior applies:

  • Enter at the end of the last paragraph inside a blockquote creates a new paragraph still inside the blockquote. Pressing Enter again on an empty paragraph exits the blockquote.
  • Backspace at the start of the first paragraph inside a blockquote lifts the content out of the blockquote.
InputResult
> + spaceWrap line in a blockquote

Type > at the start of a new line, then press space. The line wraps in a blockquote. Unlike heading input rules, blockquote wrapping is additive: typing > + space inside an existing blockquote creates a nested blockquote.

Blockquote registers a button in the toolbar with the name blockquote in group blocks at priority 150.

ItemCommandIconShortcut
BlockquotetoggleBlockquotequotesMod-Shift-B
{
"type": "blockquote",
"content": [
{
"type": "paragraph",
"content": [
{ "type": "text", "text": "A wise quote" }
]
}
]
}

A blockquote with multiple paragraphs:

{
"type": "blockquote",
"content": [
{
"type": "paragraph",
"content": [
{ "type": "text", "text": "First paragraph" }
]
},
{
"type": "paragraph",
"content": [
{ "type": "text", "text": "Second paragraph" }
]
}
]
}

A nested blockquote (created by typing > + space inside an existing blockquote):

{
"type": "blockquote",
"content": [
{
"type": "blockquote",
"content": [
{
"type": "paragraph",
"content": [
{ "type": "text", "text": "Nested quote" }
]
}
]
}
]
}

@domternal/core - Blockquote.ts