Copy Selected Links as Markdown

Copy selected link(s) on any page as Markdown: [text](url).

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Author
Pipecraft
Daily installs
0
Total installs
3
Ratings
0 0 0
Version
0.1.2
Created
2025-12-04
Updated
2025-12-05
Size
4.54 KB
License
MIT
Applies to
All sites

Copy Selected Links as Markdown

Copy selected link(s) on any page to the clipboard as Markdown in the form [text](url). Supports single or multiple anchors inside selection, URL text detection, and page fallback. Includes a keyboard shortcut and a menu command.

中文版

Features

  • Copies selected link(s) as Markdown [text](url)
  • Single or multiple anchors; for multiple links outputs a Markdown bullet list
  • Detects URL in selected text when no anchor is present
  • Fallback to [document.title](location.href) when nothing is selected
  • Keyboard shortcut: Cmd/Ctrl + Shift + M
  • Menu command via GM_registerMenuCommand

Supported Sites

  • All sites: *://*/*

Installation

  1. Install a user script manager:
  2. Install the script:

Usage

  • Select link(s) or text on the page
  • Trigger one of the following:
    • Press Cmd/Ctrl + Shift + M
    • Use the menu command “复制选中链接为 Markdown”
  • Clipboard will contain Markdown; multiple links produce a Markdown bullet list

Technical Details

  • Finds anchors that intersect the current selection range and parent anchor when cursor is inside a link
  • Builds absolute URLs via new URL(anchor.href, location.origin)
  • Uses Clipboard API with document.execCommand('copy') fallback

Compatibility

Works on modern browsers with Tampermonkey/Violentmonkey.

Changelog

v0.1.0

  • Initial release: selection parsing, multi‑link output, shortcut and menu

More Useful Scripts

License

MIT License — see the repository LICENSE file.

Contributing

Issues and pull requests are welcome!

Related Links