Copy Selected Links as Markdown

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
Pipecraft
今日安裝
0
安裝總數
2
評價
0 0 0
版本
0.1.2
建立日期
2025-12-04
更新日期
2025-12-05
尺寸
4.5 KB
授權條款
MIT
腳本執行於
所有網站

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