Smart Markdown Paste
Paste Markdown into the current section and automatically rebase ATX headings to fit the surrounding document hierarchy.
Install from the Visual Studio Marketplace.
How to use
- Copy a Markdown fragment.
- Place your cursor inside the section where it belongs.
- Press Ctrl+Alt+V on Windows/Linux or Cmd+Alt+V on macOS.
- The pasted headings are shifted together so the shallowest heading becomes a direct child of the current section.
You can also run Markdown: Paste with Rebased Headings from the Command Palette.
Example
Current document:
# Document
## Existing section
<!-- cursor -->
Clipboard:
# Foo
## Bar
### Baz
Result:
# Document
## Existing section
### Foo
#### Bar
##### Baz
The relative hierarchy is preserved; only the heading depth changes.
Behavior
- No parent heading: paste unchanged.
- No ATX headings in the clipboard: paste unchanged.
- Headings inside fenced code blocks and YAML front matter are ignored.
- Pasting while the cursor is inside a fenced code block or YAML front matter is literal.
- If rebasing would require an H7 or deeper heading, the paste is cancelled instead of flattening or corrupting the hierarchy.
- With multiple cursors, the clipboard is pasted literally because each cursor can have a different heading context.
Setext headings (Heading followed by === or ---) are intentionally left unchanged.
Shortcut
The extension contributes Ctrl+Alt+V on Windows/Linux and Cmd+Alt+V on macOS itself; no keybindings.json setup is required.
VS Code currently uses the same shortcut for editor dictation. This extension intentionally takes precedence while focus is in a writable Markdown editor. Dictation remains available elsewhere, and user keybindings can always override the extension binding.