Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Copy Embed Code

dustinhodustinho61 downloads

Adds a 'Copy Embed Code' option to right-click context menu for images. Works in Live Preview and Reading Mode, including nested embeds.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates1

An Obsidian plugin that adds a "Copy Embed Code" option to the right-click context menu for images.

Features

  • Works everywhere: Live Preview, Reading Mode, and nested embeds (transclusions)
  • Local images: Copies wikilink format ![[filename.png]]
  • External images: Copies markdown format ![](https://raw.githubusercontent.com/dustinho/obsidian-copy-embed-code/HEAD/url)

The Problem

Obsidian's standard editor-menu API relies on cursor position, but clicking an image doesn't always move the cursor—especially when the image is inside an embed (transclusion), or nested multiple levels deep.

How It Works

Event Flow

  1. Right-click captured - A global contextmenu listener (capture phase) detects the click
  2. Image detection - Walks up the DOM tree from the click target to find any <img> element
  3. Menu injection - Adds "Copy Embed Code" via Obsidian's Menu API or DOM injection
  4. Copy action - Generates appropriate embed syntax and copies to clipboard

Handling Nested Embeds

The plugin uses DOM-based detection rather than cursor position:

Document
  └── contextmenu listener (capture phase)
        └── Walks up DOM tree from evt.target
              └── Finds <img> regardless of nesting depth

This means an image 5 levels deep (blockquote → embed → callout → embed → image) works identically to a top-level image.

Dual Injection Strategy

Context Method
Edit mode Hooks into Obsidian's editor-menu event
Reading mode / nested embeds Injects directly into .menu DOM element

Installation

Manual Installation

  1. Download main.js and manifest.json from the releases
  2. Create folder: <vault>/.obsidian/plugins/copy-embed-url/
  3. Copy files into the folder
  4. Enable the plugin in Obsidian settings

From Source

npm install
npm run build

Usage

  1. Right-click any image in Obsidian
  2. Click "Copy Embed Code"
  3. Paste the embed code wherever needed

License

MIT

81%
HealthExcellent
ReviewCaution
About
Copy embed code for any image via a right-click menu in Live Preview, Reading view, and nested transclusions. Get local images as wiki-style embeds (![[file.png]]) and external images as markdown image links, copied to clipboard regardless of nesting depth.
ImagesLinks
Details
Current version
1.0.0
Last updated
4 months ago
Created
4 months ago
Updates
1 release
Downloads
61
Compatible with
Obsidian 0.15.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
dustinhodustinho
GitHubdustinho
  1. Community
  2. Plugins
  3. Images
  4. Copy Embed Code

Related plugins

Leaflet

Interactive maps inside your notes.

Auto Card Link

Automatically fetches metadata from a URL and makes it as a card-styled link.

Smart Connections

AI link discovery copilot. See related notes as you write. Lookup using semantic (vector) search across your vault. Zero-setup local model for embeddings, no API keys, private.

Excalidraw

Visual PKM powerhouse. Create and edit Excalidraw drawings.

Image Converter

Convert, compress, resize, annotate, markup, draw, crop, rotate, flip, align, drag-resize, rename with variables, and batch process images: WEBP, JPG, PNG, HEIC, TIF

Link Favicons

See the favicon for a linked website.

Image Context Menus

Image context menus (mostly on right click): Copy to clipboard, Open in default app, Show in system explorer, Reveal file in navigation, Open in new tab.

PlantUML

Generate PlantUML diagrams.

Advanced URI

Control everything with URI.

Ink

Hand write or draw directly between paragraphs using a digital pen, stylus, or Apple pencil.