Jeremy Hou624 downloadsInstantly turns messy AI output into clean Obsidian notes on paste. Removes excessive blank lines, fixes code blocks, headers, removes emojis, and more.
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, broken LaTeX math, emojis, and more. 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.
| 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 $ |
| Tracking URLs | https://example.com/?utm_source=chatgpt.com |
https://example.com/ |
Clean AI Paste runs automatically. Just press Ctrl+V or Cmd+V to paste from anywhere into your Obsidian note.
?utm_source=, ?gclid=, ?fbclid=, etc.) from pasted URLs.**## Header** → ## Header).**[Link](url)** → [Link](url)).# → ##). Capped at ######.\(, \), \[, \]) to Obsidian's native $ and $$. Leaves content inside inline code untouched.--- separators so they render correctly. (A heading placed directly after a rule is always kept tight against it — see below.)`code`. Blocks with a language label (like ```python) and multi-line blocks are always kept as full blocks. (Off by default.)python line above an unlabeled fence) and binds them into the opening backticks (```python).Ctrl+V or Ctrl+Shift+V) opens a wide popup showing three panels: the raw text/plain, the raw text/html, and the plugin's formatted output. You can inspect all three and choose which to insert — useful for understanding exactly why a paste looks the way it does.These actions happen on every external paste, regardless of your settings:
Ctrl+V, content copied from inside Obsidian passes through completely untouched; the plugin's formatting only activates for content from outside (browsers, AI chat interfaces, etc.). (A bypass Ctrl+Shift+V with Keep Markdown structure on bypass enabled may still apply its light cleanup to internal content — use a normal Ctrl+V for a truly untouched internal paste.)text/html from the clipboard and converts it to native Markdown using Obsidian's built-in engine, preserving headings, bold, lists, links, and code blocks.Everything in the Features section is applied on top of this baseline and can be individually toggled and customized.
main.js and manifest.json into YourVault/.obsidian/plugins/clean-ai-paste/.Simply copy and paste whatever text using the standard shortcut: Ctrl+V (Windows/Linux) or Cmd+V (macOS). All formatting rules fire instantly and automatically.
To bypass the plugin's formatting pipeline, use: Ctrl+Shift+V (Windows/Linux) or Cmd+Shift+V (macOS). Bypass paste never wraps content in a code fence, and it skips every formatting rule from the Features section.
What it inserts depends on the Keep Markdown structure on bypass toggle in the settings (on by default):
<br> tags rather than proper <code> blocks on the clipboard. When this happens, it's impossible for the plugin's parser to detect it as code, and it will be pasted as plain text.If you encounter a bug, have a feature request, or want to suggest an improvement, please open an issue on the GitHub repository.
Issue templates are provided to make reporting bugs and requesting features as quick and easy as possible!
If you find this plugin useful, please consider giving it a star on GitHub or consider supporting its development!