konstantinosgkilas167 downloadsAutomatically cleans and transforms clipboard content on paste — converts HTML to markdown, fetches link titles, strips trackers, and normalizes whitespace.
A plugin that intercepts paste events and automatically cleans and transforms clipboard content before it reaches your notes. Raw HTML is converted to clean Markdown, bare URLs become titled links, tracking parameters are stripped, and whitespace is normalized.
<span> elements).[Page Title](url) Markdown link. Falls back gracefully to the plain URL if the title cannot be fetched within 5 seconds.utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_id, fbclid, gclid, gclsrc, mc_cid, mc_eid, msclkid, twclid, igshid, _ga, _gl, yclid, _hsenc, _hsmi, vero_id, mkt_tok, and any custom parameters you configure./ref= tracking paths from Amazon and amzn.to product URLs.When you paste (Ctrl/Cmd+V), the plugin checks the following conditions in order:
Only after all these checks pass does the plugin intercept the paste and apply transforms:
main.js, manifest.json, and styles.css from the latest releasesmart-paste inside your vault's .obsidian/plugins/ directorygit clone https://github.com/konstantinosGkilas/smart-paste.git
cd smart-paste
npm install
npm run build
Copy main.js, manifest.json, and styles.css into your vault's .obsidian/plugins/smart-paste/ directory.
All settings are found under Settings > Community plugins > Smart Paste.
| Setting | Default | Description |
|---|---|---|
| Enable smart paste | On | Master toggle. When disabled, all paste events pass through normally. |
| Convert HTML to Markdown | On | Converts rich HTML clipboard content into clean Markdown. |
| Fetch link titles for urls | On | When pasting a single bare URL, fetches the page title and creates a [title](url) link. |
| Strip tracking parameters from urls | On | Removes common tracking parameters from all URLs in pasted content. |
| Normalize whitespace | On | Collapses excessive blank lines, trims trailing spaces, and normalizes line endings. |
| Custom tracking parameters | Empty | A comma-separated list of additional URL parameter names to strip beyond the built-in defaults. |
The HTML-to-Markdown converter handles the following elements:
| HTML | Markdown |
|---|---|
<h1> through <h6> |
# through ###### |
<strong>, <b> |
**bold** |
<em>, <i> |
_italic_ |
<del>, <s> |
~~strikethrough~~ |
<a href="..."> |
[text](url) |
<img> |
 |
<ul>, <ol>, <li> |
- item or 1. item (nested with indentation) |
<blockquote> |
> quoted text |
<pre><code> |
Fenced code block with language detection |
<code> |
`inline code` |
<table> |
Pipe-delimited Markdown table |
<br> |
Line break |
<hr> |
--- |
<p>, <div> |
Block-level separation |
<sup>, <sub> |
<sup>, <sub> (inline HTML) |
<span style="font-weight:bold"> |
**bold** (Google Docs / Word) |
<span style="font-style:italic"> |
_italic_ (Google Docs / Word) |
<span style="text-decoration:line-through"> |
~~strikethrough~~ (Google Docs / Word) |
<script>, <style>, <meta> |
Stripped entirely |
npm install # Install dependencies
npm run dev # Watch mode with inline source maps
npm run build # Production build (minified, no source maps)
npm run lint # Run eslint with obsidianmd plugin rules
npm test # Run unit tests
main.ts Entry point, paste event registration
src/
settings.ts Settings interface and settings tab
paste-handler.ts Orchestration: clipboard data to processed text
html-to-markdown.ts DOMParser-based HTML to Markdown converter
url-cleaner.ts URL cleaning and tracking parameter removal
url-titler.ts Page title fetching via requestUrl
whitespace.ts Whitespace normalization
tests/
html-to-markdown.test.ts HTML conversion tests (34 cases)
url-cleaner.test.ts URL cleaning tests (22 cases)
whitespace.test.ts Whitespace normalization tests (10 cases)
eslint.config.mjs ESLint 9 flat config with obsidianmd plugin
esbuild.config.mjs esbuild bundler configuration
jest.config.js Jest test runner configuration
tsconfig.json TypeScript strict mode configuration
DOMParser API. No external libraries are bundled.preventDefault(). The plugin checks for images, code blocks, frontmatter, and the enabled state before intercepting the paste event. This ensures default behavior is always preserved when the plugin should not act.Promise.race with a 5-second timeout to avoid blocking the paste operation on slow or unresponsive servers.git checkout -b feature/my-feature)npm run lint and npm test to verify