An Obsidian plugin that intelligently pastes content with preserved indentation hierarchy, inline formatting, and automatic bullet point inheritance.
When pasting content from AI assistants (ChatGPT, Claude), websites, or other markdown editors into Obsidian:
- Indentation breaks - Nested lists lose their hierarchy
- Extra empty lines - Unwanted blank lines appear between bullet points
- Formatting lost - Bold, italic, code, links, and images disappear
- No bullet inheritance - Multi-line text doesn't auto-convert to bullet lists
Smart Paste intercepts paste events and:
- Preserves relative indentation - Pasted content inherits the current cursor's indent level
- Maintains hierarchy - Nested lists stay nested
- Keeps inline formatting -
**bold**,*italic*,`code`,[links](url), andare preserved - Cleans empty lines - Removes extra blank lines between bullets
- Auto-inherits bullets - When pasting into a bullet line, each line becomes a bullet
Before (native Obsidian paste):
- Parent item
- Child item 1 ← Lost indentation!
- Child item 2 ← Lost indentation!
After (with Smart Paste):
- Parent item
- Child item 1 ← Preserved!
- Child item 2 ← Preserved!
Auto-inherit bullets - Paste plain text into - :
Input (plain text):
Line 1
Line 2
Line 3
Output (when cursor is at "- "):
- Line 1
- Line 2
- Line 3
- Download the latest release from Releases
- Extract to your vault's
.obsidian/plugins/smart-paste/directory - Reload Obsidian
- Enable "Smart Paste" in Settings → Community plugins
cd /path/to/vault/.obsidian/plugins
git clone https://github.com/gr-luo/obsidian-smart-paste.git smart-paste
cd smart-paste
npm install
npm run build| Setting | Default | Description |
|---|---|---|
| Paste Mode | Manual | Manual: use command/hotkey for smart paste. Auto: hijack all paste events |
| Clean Empty Lines | On | Remove extra blank lines between bullets |
| Indent Style | Auto | Choose: Auto detect / Tab / Spaces |
| Spaces per Indent | 2 | Number of spaces per indent level |
- Cmd+V - Normal paste (native Obsidian behavior)
- Command Palette → "Smart Paste: Paste with Smart Formatting" - Smart paste
- Set a custom hotkey (e.g.,
Cmd+Shift+V) in Settings → Hotkeys
- Cmd+V - All pastes are automatically processed with smart formatting
| Content | Conversion |
|---|---|
Lists <ul>/<ol> |
Smart indentation preserved |
Links <a href> |
[text](url) |
Images <img> |
 |
Bold <strong> |
**text** |
Italic <em> |
*text* |
Code <code> |
`text` |
Tables <table> |
Skipped (uses plain text) |
- Captures paste event in DOM capture phase (before other plugins)
- Reads HTML clipboard (
text/html) to preserve structure - Converts HTML to Markdown with proper indentation
- Applies relative indentation based on cursor position
- Auto-inherits bullet prefix when pasting multi-line text
- Uses
document.addEventListener('paste', fn, true)for event priority - Parses HTML with
DOMParserfor accurate hierarchy detection - Tracks
prevWasParagraphstate for correct list indentation - Recursively processes inline elements to preserve formatting
- Detects tables and skips processing to avoid corruption
- Obsidian v1.0.0+
- Desktop and Mobile
Smart Paste automatically skips these areas (native paste behavior):
- File title
- Property/Metadata (frontmatter) section
- Code blocks
- Tables are skipped (plain text fallback)
- Complex nested HTML structures may not convert perfectly
# Install dependencies
npm install
# Build (one-time)
npm run build
# Watch mode
npm run devIssues and PRs welcome! See CLAUDE.md for development guidelines.
MIT
Built with Claude Code