Clean AI Paste
pendingby Jeremy Hou
Automatically formats pasted text from AI chats by stripping blank lines, unbolding headers, and fixing code blocks.
Clean AI Paste for Obsidian
Clean AI Paste is an Obsidian plugin designed to automatically clean up and format text pasted from AI chatbots (ChatGPT, Claude, Gemini, etc.) instantly and silently, every time you paste.
When you copy text from an AI web interface, the result in Obsidian is often cluttered with excessive blank lines, malformed code blocks, over-bolded headers, and broken LaTeX math. This plugin intercepts the paste event, converts the clipboard HTML to native Markdown, and applies a fully customizable set of formatting rules before inserting it into your note.
Main Features Before & After
| Feature | Original AI Paste | With Clean AI Paste |
|---|---|---|
| Headers | ### **Introduction** | ### Introduction |
| Blank Lines | Paragraph.Next paragraph. | Paragraph.Next paragraph. |
| Code Blocks | python```print("hi")``` | ```pythonprint("hi")``` |
| Math (LaTeX) | \( x = y \) | $ x = y $ |
Features
Formatting & Cleanup
- Condense Blank Lines — Strips excessive vertical spacing generated by AI between paragraphs, lists, and sections.
- Strip Trailing Whitespaces — Removes invisible trailing spaces at the end of every line. Ideal for clean
git diffoutput. - Strip Emojis — Removes all emoji characters from pasted text for a cleaner, more professional note.
Markdown Elements
- Unbold Headers — Strips bold markers (
**or__) from Markdown headers, supporting both**## Header**and## **Header**formats. - Header Downgrade Level — Automatically shifts pasted headers down by 1, 2, or 3 levels (e.g.,
#→##) so pasted content doesn't visually overpower your document's main title. - Convert Math Delimiters — Converts AI-style LaTeX delimiters (
\(,\),\[,\]) into Obsidian's native$and$$formats for instant rendering. - Format Horizontal Rules — Ensures proper blank-line padding around
---separators. - Padding Before/After Code Blocks — Independently control whether a blank line is inserted before and after every code block.
Code Block Intelligence
- Detached Language Labels — Automatically detects floating language names (e.g., a bare line reading
pythonabove an unlabeled code block) and binds them into the opening backticks (```python). - Duplicate Label Removal — Detects and removes the redundant language label that Claude generates when copying manually (e.g.,
bashfloating above```bash). - Indentation Stripping — Automatically left-aligns code blocks that are deeply indented inside numbered lists or step-by-step instructions.
AI Tracking & Notifications
- Add Tracking Signature — Wraps pasted text with fully customizable hidden HTML comments (invisible in Reading View) to mark AI-generated blocks in source. The start and end tags are independently configurable.
- Enable Paste Notifications — Shows a brief Obsidian
Noticepopup when the plugin fires. Off by default for silent operation.
How to Use
Simply paste from your AI tool of choice using the standard shortcut:
- Windows / Linux:
Ctrl+V - macOS:
Cmd+V
All formatting rules fire instantly and automatically. To bypass the plugin entirely and paste raw, unformatted text, use Shift+Ctrl+V or Shift+Cmd+V while pasting.
Settings
All rules are individually toggleable from Settings → Clean AI Paste. Settings are organized into three sections:
- Formatting & Cleanup — Global text cleanup rules.
- Markdown Elements — Rules for specific Markdown syntax.
- AI Tracking & Notifications — Source-level tracking and user feedback.
Installation
From the Community Plugin Store (Recommended)
- Open Obsidian and go to Settings → Community plugins.
- Disable Restricted mode if prompted.
- Click Browse and search for Clean AI Paste.
- Click Install, then Enable.
Manual Installation
- Download the latest release from the GitHub repository.
- Copy the
main.jsandmanifest.jsonfiles into a new folder atYourVault/.obsidian/plugins/clean-ai-paste/. - In Obsidian, go to Settings → Community plugins, refresh Obsidian, find Clean AI Paste, and toggle it ON.
Compatibility
- Obsidian: 0.15.0+
- Platform: Desktop and Mobile (iOS & Android)
License
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.