Paste Link As

by llighter
5
4
3
2
1
Score: 50/100

Description

Obsidian plugin: paste a URL as a titled link, then turn it into a mention or a link card.

Reviews

No reviews yet.

Stats

1
stars
98
downloads
0
forks
6
days
3
days
3
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
8
commits

Latest Version

4 days ago

Changelog

Full Changelog: https://github.com/llighter/paste-link-as/compare/1.2.1...1.2.2

  • Link cards are now at most 40rem wide. They still fill narrow panes, but no longer stretch when the line width is wider (for example, Minimal's line width set above 40).
  • To change the limit, set --paste-link-as-card-max-width in a CSS snippet, e.g. body { --paste-link-as-card-max-width: none; } to let cards fill the line again.

README file from

Github

English | 한국어 | 简体中文 | 日本語 | Español | Français

Paste a URL into an Obsidian note and choose how it lands: a titled link, an inline mention, or a link card. Everything is written as plain Markdown, so your notes stay readable without the plugin.

Mentions and link cards in a note

How it works

Paste a URL into a note. It goes in as [Title](url) right away, and a small menu opens under it:

  • Keep: stays a titled link.
  • Mention: favicon, site name and title on one line, shortened with … when it's too long.
  • Card: thumbnail, title, a two-line description, and the favicon with the link address.

Use ↑/↓ and Enter (or Tab) to pick, and Esc to close. To ignore the menu, just keep typing; Enter on Keep starts a new line as usual.

Pasting a YouTube URL: it goes in as a titled link, then becomes a mention and a card from the menu

Watch the demo as MP4

You can also convert a URL that is already in a note. Select it (a bare URL or a [Title](url) link) and run a command:

  • Turn link into card
  • Turn link into mention

With nothing selected, the commands ask for a URL. The plugin sets no default hotkeys; assign your own in Settings → Hotkeys.

The menu, commands and settings follow Obsidian's language: English, Korean, Simplified Chinese, Japanese, Spanish or French. Traditional Chinese uses Simplified Chinese, and any other language falls back to English.

What gets written

Keep leaves a titled link:

[The Odyssey | Official Trailer](https://www.youtube.com/watch?v=Mzw2ttJD2qQ)

A mention is a regular Markdown link. For a YouTube video, the site name is the channel name:

[![|16](https://raw.githubusercontent.com/llighter/paste-link-as/HEAD/favicon-youtube.com.png) *Channel name* The Odyssey | Official Trailer](https://www.youtube.com/watch?v=Mzw2ttJD2qQ)

A card is a [!link] callout:

> [!link] [The Odyssey | Official Trailer](https://www.youtube.com/watch?v=Mzw2ttJD2qQ)
> ![[link-youtube.com-h5vbt4.jpg]]
>
> The Odyssey - In Theaters 07.17.26…
>
> ![[favicon-youtube.com.png|16]] https://www.youtube.com/watch?v=Mzw2ttJD2qQ

There is no plugin-specific syntax. With the plugin turned off, a mention shows as a normal link and a card as a normal callout; only the styling goes away.

Clicking anywhere on a card or a mention opens the link. To edit a card in Live Preview, move the cursor into it from the line below.

When a paste is left alone

The menu doesn't open, and the paste works as usual, when:

  • the clipboard holds anything other than a single URL, or an image URL;
  • you paste inside a link target (](), right after a quote, < or [, inside code, or in the properties;
  • you're offline.

Pasting a URL over selected text links that text: [selected text](url).

Inside lists, blockquotes and tables the menu has no Card option, since a card is a multi-line callout.

Settings

  • Image folder: where thumbnails and favicons are saved. Leave it empty to use the attachment location from Obsidian's settings.

Network use

When you paste a URL or run a command, the plugin requests that page directly from its own site to read the title, description, image and favicon. For cards and mentions it downloads the image and the favicon from that site and saves them in your vault. No other remote service is contacted, nothing from your notes is sent anywhere, and there is no telemetry.

Saved files

  • Favicons: favicon-<domain>.<ext>, one per domain. Formats Obsidian can't display, such as .ico, are converted to PNG.
  • Thumbnails: link-<domain>-<hash>.<ext>.

Existing files are reused, so pasting another link from the same site doesn't download its favicon again.

Styling

styles.css only matches cards ([!link] callouts) and mentions (a link that holds a 16px image and an italic site name). Other links and images keep your theme's look. To adjust the look, override these selectors in a CSS snippet.

Title weight comes from --paste-link-as-title-weight (500 by default). To change it, add a CSS snippet such as body { --paste-link-as-title-weight: 600; }.

Limitations

  • While the menu is open, ↑/↓ move inside the menu. Press Esc first to move the cursor.
  • In Live Preview, a line with a mention stays on one line, ending with …, until the cursor is on it. Other text on that line is shortened too.
  • A link that holds a 16px-wide image and italic text is styled as a mention, and a callout of type link as a card.
  • Plugins that also rewrite pasted URLs, such as Auto Link Title, handle the same paste event. Turn off their paste handling so that one paste isn't handled twice.

Installation

  • Community plugins: Settings → Community plugins → Browse, then search for "Paste Link As" (once it is listed).
  • Manually: download main.js, manifest.json and styles.css from the latest release into <vault>/.obsidian/plugins/paste-link-as/, reload Obsidian, and enable the plugin.

License

MIT