Reference
Commands
Every command, for keymaps and agents.
Commands are pure functions (state, params) → Edit. Run them with runCommand(state, name, params) or as agent tools; every command also accepts target.
| Command | Params | Description |
|---|---|---|
toggleMark | mark (bold | italic | code | strike) | Toggle bold (**), italic (_), code (`) or strikethrough (~~) around the selection or the word at the cursor. |
setHeading | level | Set the heading level of the selected lines. Level 0 makes them paragraphs. |
toggleList | kind (bullet | ordered | task) | Toggle a bullet, ordered or task list on the selected lines. |
toggleTask | checked | Check or uncheck the task items in the selection. |
toggleQuote | – | Toggle a blockquote on the selected lines. |
insertLink | url | Wrap the selection in a Markdown link. |
insertComponent | name, props, content, inline | Insert a block (or inline) component at the selection. The selection becomes its content. |
wrapComponent | name, props | Wrap the selected lines in a block component (nesting colons are added as needed). |
unwrapComponent | – | Remove the component at the cursor and keep its content. |
setProps | props | Set or remove (value null) attributes of the component at the cursor. |
propsToYaml | – | Move the attribute block of the component at the cursor into a YAML props block. |
setFrontmatter | key, value | Set a top-level frontmatter key (value null removes it). Creates the frontmatter when missing. |
formatTable | – | Align the columns of the table at the cursor. |
insertFootnote | content, id | Insert a footnote reference at the cursor and its definition at the end of the document. |
applyPunctuation | – | Replace straight quotes, --, --- and ... with typographic characters in prose (selection, or the whole document). |