Auto Paste Link

by cnwenzhihong
5
4
3
2
1
Score: 35/100
New Plugin

Description

This plugin has not been manually reviewed by Obsidian staff. Auto formats pasted URLs as Markdown links, media embeds, and supported site titles.

Reviews

No reviews yet.

Stats

stars
downloads
0
forks
0
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Auto Paste Link is an Obsidian plugin that formats a single pasted URL into a Markdown link, image embed, or video embed. For selected supported websites, it can also fill the link title automatically.

中文:这是一个 Obsidian 插件,用于在粘贴单个 URL 时自动生成 Markdown 普通链接、图片嵌入或视频嵌入。对受支持的重要站点,可以自动补全链接标题。

Demo

Open demo video

中文:打开演示视频

Core Behavior

  • Normal URL: inserts [](URL) and keeps the cursor inside [].
  • Selected text + normal URL: inserts [selected text](URL).
  • Supported website URL: inserts [](URL) first, then fills the title when the title request succeeds.
  • Image URL: inserts ![](https://raw.githubusercontent.com/cnwenzhihong/Obsidian-auto-paste-link/HEAD/URL).
  • Direct video file URL: inserts <video src="URL" controls muted autoplay loop></video>.
  • Mixed text is not converted.
  • YAML frontmatter is ignored by default.
  • Ctrl+Shift+V keeps Obsidian's plain paste behavior and skips plugin processing.

Examples

Normal link:

[](https://www.baidu.com)

Normal link with selected text:

[百度](https://www.baidu.com)

Image link:

![](https://images.steamusercontent.com/ugc/example/hash/?imw=5000)

Video link:

<video src="https://example.com/video.mp4" controls muted autoplay loop></video>

Supported Title Sites

Automatic title fetching is intentionally limited to important supported sites:

  • bilibili
  • YouTube
  • Fab
  • GitHub
  • Stack Overflow
  • Stack Exchange
  • Reddit
  • Wikipedia
  • Steam
  • MDN
  • npm
  • Zhihu
  • Juejin
  • CSDN
  • WeChat Official Accounts
  • Douban
  • CNBlogs

Other websites are not fetched for titles.

Image Detection

Image detection is deliberately conservative. The plugin does not treat every CDN as an image source.

Detection order:

  1. Image file extension, such as .jpg, .png, .webp, .gif, .svg, .avif.
  2. Trusted image sources.
  3. Advanced regular expressions.

Built-in trusted image sources include:

  • images.unsplash.com/
  • i.imgur.com/
  • images.steamusercontent.com/
  • pbs.twimg.com/media/
  • i.ytimg.com/vi/
  • img.youtube.com/vi/
  • i0.hdslb.com/bfs/
  • i1.hdslb.com/bfs/
  • i2.hdslb.com/bfs/

Generic CDN domains such as cloudfront.net, akamaihd.net, fastly.net, and googleusercontent.com are not built in, because they can serve images, webpages, scripts, downloads, and many other resource types.

Custom Trusted Image Sources

Use custom trusted image sources for hosts or paths that clearly serve images.

Each source has:

  • Host: required, for example images.example.com.
  • Path prefix: optional, for example /media/.
  • Include subdomains: optional. Keep it off unless subdomains are also known image sources.

Examples:

host: images.example.com
path prefix: /media/
include subdomains: off

This matches:

https://images.example.com/media/abc

It does not match:

https://images.example.com/files/abc
https://sub.images.example.com/media/abc

If include subdomains is enabled, then subdomains such as cdn.images.example.com can also match.

Advanced Regular Expressions

Advanced image URL regular expressions are still available for edge cases, but they should be treated as an escape hatch.

Use trusted image sources first. Use regular expressions only when a source cannot be expressed by host and path prefix.

The default advanced rule recognizes explicit image format query parameters, for example:

https://example.com/resource?id=1&format=jpg

Settings

  • Auto fetch supported site titles: enabled by default.
  • Title request timeout: 3000ms by default. Fab is usually slower than other supported sites.
  • Use selected text as the link title: enabled by default.
  • Process YAML frontmatter: disabled by default.
  • Auto embed image links: enabled by default.
  • Add newline after image links: enabled by default.
  • Image extensions are configurable.
  • Custom trusted image sources are configurable.
  • Advanced image URL regular expressions are configurable.
  • Auto embed video links: enabled by default.
  • Video extensions are configurable. The default is mp4.

Manual Installation

  1. Download main.js, manifest.json, and styles.css from the latest GitHub release.
  2. Create this folder in your vault: .obsidian/plugins/auto-paste-link/.
  3. Put the three downloaded files into that folder.
  4. Enable the plugin in Obsidian settings.

Development

corepack pnpm install
corepack pnpm test
corepack pnpm build

The GitHub release tag must exactly match the version in manifest.json, for example 1.0.3 without a v prefix. Release assets must include main.js, manifest.json, and styles.css.