Pasted URL Linter

unlisted

by Quietbday

Cleans up URLs as you paste them: strips tracking parameters, canonicalises Amazon product links, and removes notification counts from link titles.

Updated 9d agoMIT
View on GitHub

Pasted URL Linter

An Obsidian plugin that cleans up and formats URLs as you paste them into your notes. It started as a YouTube-timestamp formatter and has grown into a general URL linter. (YouTube timestamp conversion now lives in its own plugin, YT links.)

Features

The plugin watches what you paste and tidies up links automatically. Each rule can be turned on or off in Settings → Pasted URL Linter (all are on by default, except Also clean bare URLs). Whenever a paste is cleaned, a short notification confirms what happened. Anything the plugin doesn't recognise is pasted normally, untouched.

Links are found anywhere in a line, so a bulleted item like - [title](url) is cleaned in place, and a multi-line paste (for example several browser tabs copied as a bulleted list) has every line linted individually. Multiple links on one line are all processed. When more than one link changes, a single summary notification reports the total, e.g. Linted 6 of 10 links · removed 14 tracking parameters.

You can also lint links that are already in a note: select the text and run the command Lint URLs in selected text (from the command palette, or bind it to a hotkey). It treats the selection exactly like a fresh paste — single-line or multi-line — and replaces it with the cleaned version. With nothing selected it does nothing and says so.

1. Strip tracking parameters

When you paste a Markdown link, the plugin removes a broad list of known tracking parameters — utm_* and other utm_-style families, ad and click IDs (gclid, fbclid, igshid, msclkid, …), affiliate tags, email-campaign IDs, and more — while keeping the link text and any genuine query parameters. The list is case-insensitive and also matches by prefix, so a brand-new utm_something is caught too.

Tracking data hidden in the #fragment is cleaned intelligently: real anchors (#body, #section) and single-page-app routes (#/path) are preserved, and only fragments that are actually encoded tracking data are removed.

Paste this:

[Rubber Band Powered Cup Launcher | KiwiCo](https://www.kiwico.com/diy/stem/motion-mechanics/rubber-band-powered-cup-launcher?utm_content=sub&utm_campaign=NP-EOTW&utm_source=blast#body)

Get this:

[Rubber Band Powered Cup Launcher | KiwiCo](https://www.kiwico.com/diy/stem/motion-mechanics/rubber-band-powered-cup-launcher#body)

(The #body anchor is now kept, because it is a real anchor rather than tracking data.)

The broader list includes some aggressive generic names (ref, tag, source, campaign, …). These clean far more, but can occasionally strip a legitimate parameter such as a blog's ?tag= or a site's ?q= search. Rather than turning the whole rule off, you can add that site to the Tracking-parameter exceptions list (one domain per line or comma-separated) to leave its links untouched. Subdomains are included automatically, so example.com also covers www.example.com.

2. Clean Amazon product links

When you paste a Markdown link to an Amazon product page, the plugin shortens it to its canonical …/dp/<ASIN> (or …/gp/product/<ASIN>) form, dropping the /ref=… code, query, and fragment.

Paste this:

[Strange Houses : Uketsu : Amazon.ca: Books](https://www.amazon.ca/Strange-Houses-Novel-Uketsu/dp/006343315X/ref=asc_df_006343315X?mcid=0377&tag=googleshopc0c-20)

Get this:

[Strange Houses : Uketsu : Amazon.ca: Books](https://www.amazon.ca/Strange-Houses-Novel-Uketsu/dp/006343315X)

3. Strip notification counts

Many social and messaging sites prefix a browser tab title with a notification/badge count, so a copied link title ends up looking like (14) Home / X. When you paste a Markdown link, the plugin removes that count from the title while leaving the URL alone.

The count can be at the start of the title, or embedded as a standalone piece (as Gmail does). Only short counts — up to 3 digits, with an optional trailing + — are removed, so a legitimate number like a year in Blade Runner (2049) is kept.

Paste this:

[(14) Home / X](https://x.com/home)

Get this:

[Home / X](https://x.com/home)

Or paste this:

[Inbox (47) - quietbyday@gmail.com - Gmail](https://mail.google.com/mail/u/0/#inbox)

Get this:

[Inbox - quietbyday@gmail.com - Gmail](https://mail.google.com/mail/u/0/#inbox)

Because a bare (N) could occasionally be a real part of a title, this rule only runs on domains in the Notification-count domains whitelist (one per line or comma-separated). It ships with x.com, facebook.com, youtube.com, and google.com; add your own, and remove any you don't want. Subdomains are included automatically, so google.com also covers mail.google.com. If the list is empty, no counts are stripped.

Also clean bare URLs (optional)

By default, the tracking and Amazon cleaners only act on Markdown links ([text](url)). Turn on Also clean bare URLs to have them clean plain pasted URLs too — the result stays a bare URL.

How to Install (Beta)

  1. Install the BRAT plugin from the Obsidian Community Plugins store.
  2. Go to Settings → Community plugins → BRAT .
  3. Click Add Beta plugin.
  4. Paste the following repository URL: https://github.com/Quietbyday/obsidian-pasted-url-linter
  5. Click Add Plugin.
  6. Enable "Pasted URL Linter" in Community plugins.

To update to the latest beta version, go to BRAT and click Check for updates (or restart Obsidian).

Author

Quietbday

Changelog

0.5.0-beta

  • Removed YouTube timestamp conversion. This feature was moved out to a dedicated plugin, YT links, so Pasted URL Linter can stay focused on its core job — stripping unwanted cruft from URLs. If you relied on it, install YT links, which also does more (readable timestamps, linking bare mm:ss notations to a note's source video). The retired Convert YouTube timestamp links setting is dropped automatically on upgrade.
  • Note: stripping notification counts from link titles (including YouTube titles like (58) … - YouTube) is unchanged and still lives here.

0.4.0-beta

  • Links are now detected anywhere in a line, not only when the paste is one whole link — so a bulleted Markdown link (- [title](url)) is cleaned in place, and multiple links on a line are all processed.
  • Multi-line pastes are linted line by line, so copying several browser tabs as a bulleted list now cleans every link. A single summary notification reports the total when more than one link changes.
  • Added a command, Lint URLs in selected text, that lints the current selection as if it were freshly pasted (single- or multi-line) — for tidying links already in a note without cut-and-re-paste. With nothing selected it shows a brief "No text selected" notice.
  • Inline bare http(s):// URLs sitting inside other text are now cleaned too when Also clean bare URLs is on (YouTube-timestamp conversion applies inline regardless).

0.3.2-beta

  • Added Strip notification counts: removes a notification/badge count like (14) or (20+) from a pasted Markdown link title (e.g. [(14) Home / X][Home / X], [Inbox (47) - Gmail][Inbox - Gmail]). Handles a count at the start of the title or a standalone one embedded mid-title, strips only the first count, and keeps 4-digit numbers like a year ((2049)). On by default; toggle in settings.
  • Added a Notification-count domains whitelist for that rule (pre-filled with x.com, facebook.com, youtube.com, google.com) — counts are only stripped on listed domains, and an empty list strips nowhere.
  • Added a Tracking-parameter exceptions list — domains to leave untouched by the tracking-parameter cleaner, for sites where a query is a real search or reference rather than a tracker. Both lists are subdomain-inclusive.

0.3.1-beta

  • Fixed a bug where a converted paste (e.g. a YouTube timestamp link) could be inserted twice, producing a doubled link, when Obsidian dispatched the paste event more than once

0.3.0-beta

  • Replaced the UTM-only cleaner with a much broader tracking-parameter engine, built from a merged list of ~120 known trackers (synthesised from the Eraser and clean-url extensions), with case-insensitive and prefix matching
  • Added smart fragment handling: real anchors (#body, #section) and SPA routes (#/path) are now preserved, and only encoded tracking data in the fragment is removed
  • Amazon cleaning is now canonicalisation — links are shortened to …/dp/<ASIN> rather than just cutting at /ref=
  • Notifications now report how many tracking parameters were removed
  • Renamed the settings toggles (Strip tracking parameters, Clean Amazon product links); existing settings are migrated automatically

0.2.0-beta

  • Renamed to Pasted URL Linter — broadened from YouTube timestamps into general paste-time URL cleanup
  • Added Strip UTM tracking parameters for pasted Markdown links (removes utm_* params and trailing #fragment, keeps other query params)
  • Added Strip Amazon reference codes for pasted Amazon Markdown links (removes /ref=… and everything after)
  • Added a settings screen with an on/off toggle for each rule
  • Added an optional Also clean bare URLs toggle (off by default) that extends the UTM/Amazon cleaners to plain pasted URLs
  • A brief notification now confirms whenever a paste is cleaned

0.1.0-beta

  • Initial release
  • Automatically converts pasted YouTube timestamp URLs into Markdown links
  • Supports youtu.be short links, youtube.com full links, and m.youtube.com mobile links
  • Timestamp displayed in m:ss format (e.g. 1:55) or h:mm:ss for videos over an hour

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.