Overview
Theblockquote extension adds support for blockquote nodes, which are used to represent quoted or cited text. Blockquotes can contain one or more block-level nodes.
Installation
Usage
API Reference
defineBlockquote()
Defines a blockquote node with commands, keymap, input rules, and node specification. Returns:BlockquoteExtension
This extension includes:
- Node specification
- Wrapping and unwrapping commands
- Keyboard shortcuts
- Input rules for Markdown-style syntax
defineBlockquoteSpec()
Defines only the blockquote node specification. Returns:BlockquoteSpecExtension
defineBlockquoteCommands()
Defines blockquote-related commands. Returns:BlockquoteCommandsExtension
defineBlockquoteKeymap()
Defines keyboard shortcuts for blockquote operations. Returns:PlainExtension
defineBlockquoteInputRule()
Defines input rules for Markdown-style blockquote syntax. Returns:PlainExtension
Node Specification
The blockquote node is defined with the following properties:- name:
blockquote - content:
block+(requires one or more block nodes) - group:
block - defining:
true(prevents automatic wrapping) - parseDOM:
[{ tag: 'blockquote' }] - toDOM: Renders as
<blockquote>element
Commands
setBlockquote()
Wraps the current selection in a blockquote.insertBlockquote()
Inserts a new empty blockquote node.toggleBlockquote()
Toggles blockquote wrapping for the current selection. If the selection is already in a blockquote, it unwraps it; otherwise, it wraps the selection.Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Mod-B | Toggle blockquote |
Backspace | Unwrap blockquote when at start of first child block |
Mod is Cmd on macOS and Ctrl on Windows/Linux.
Input Rules
The extension supports Markdown-style blockquote syntax:> followed by a space at the start of a line to wrap it in a blockquote.
Examples
Basic Setup
Toggle Button
With Multiple Block Types
Programmatic Control
Nested Blockquotes
Blockquotes can be nested within other blockquotes:Styling
Blockquote nodes render as standard<blockquote> HTML elements:
HTML Structure
Input HTML:Use Cases
- Citing external sources
- Highlighting important quotes
- Displaying testimonials
- Showing excerpts from other documents
- Creating visual emphasis for specific content
Accessibility
Blockquote elements are semantic HTML and are properly recognized by screen readers:- Screen readers announce blockquote boundaries
- Consider adding
citeattribute for source attribution - Use clear visual styling to distinguish quotes from regular text