prosemirror-autopairs
v0.1.1
Published
ProseMirror plugin for smart auto-pairing of brackets and quotes
Readme
prosemirror-autopairs
Smart auto-pairing of brackets and quotes for ProseMirror editors.
Features
- 🪄 Auto-inserts matching characters like
(),{},"", etc. - 🧠 Smart backspace: deletes pairs when cursor is between them
- ✍️ Wraps selected text with the typed opening/closing pair
- 🎯 Skips typing if the closing character is already present
Auto-Paired Characters
| Character Pair | Name |
| ------------------ | --------------- |
| < > | Angle brackets |
| { } | Curly braces |
| ( ) | Parentheses |
| [ ] | Square brackets |
| " " | Double quotes |
| ' ' | Single quotes |
Installation
npm install prosemirror-autopairsUsage
This plugin accepts an optional AutopairsOptions object to enable or disable specific groups of auto-closable characters.
If no options are passed, all groups are enabled by default.
import { autopairs } from 'prosemirror-autopairs';
const plugins = [
...autopairs({
angleBrackets: true,
curlyBrackets: true,
roundBrackets: true,
squareBrackets: true,
doubleQuotes: true,
singleQuotes: true,
}),
];License
This project is licensed under the MIT License.
