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

Code Embed

JavaMinerJavaMiner43 downloads

Expand reusable note fragments and preview structured prompts.

  • Overview
  • Scorecard
  • Updates6

PL · EN · DE · FR · ES · NL · IT

Define a fragment

Keep a closing instruction shared by several prompts in a note named Templates. Edit it once, and the next Copy+ in each prompt will use the updated text.

<VARIABLE>Give three examples.</VARIABLE>

Insert the following block in another note. Select Copy+ and paste the result: Give three examples.

![Templates:<<VARIABLE>>]

Put these equivalent definitions in separate notes or end the section with another heading at the same level.

## Instructions
Reply in $1. Tone: ${2:direct}.
<style>Reply in $1. Tone: ${2:direct}.</style>

Embed a fragment

![source:selector(arguments)]

Omit the source to use the current note. Use a colon only between the source and the selector.

  • ![Templates] — Whole note
  • ![Templates:3-8] — Lines, including both endpoints
  • ![Templates:#Style] — Section with heading
  • ![Templates:##Style] — Section body
  • ![Templates:##Chapter#Style] — Subsection body
  • ![Templates:<style>] — Element including its tags
  • ![Templates:<<style>>] — Element content
  • ![#Style] · ![##Style] — Local section
  • ![<style>] · ![<<style>>] — Local tag

Pass arguments

Both calls produce the result below. $1–$9 select an argument, $* joins all arguments, and ${2:direct} supplies a default when the second argument is missing or empty. Quote arguments containing commas. Pass arguments explicitly to nested embeds.

![##Instructions(English)]
![<<style>>(English)]
Reply in English. Tone: direct.

![Shared:##Tone($1)]

Preview and copy

A ce or codeembed block opens in structured View. Select View on md or xml blocks. Copy+ copies the expanded text. The block language controls presentation.

Limit lookup to a package

Open the folder context menu with a right-click or long press, or choose a folder from the command palette. Confirm the marker path when removing a root. A marked folder always shows its color and ◆ Root. Enable Show actions on all folders to show + Root on unmarked folders as well. The setting is off by default.

Code Embed uses the Obsidian interface language. Its settings show the installed version, a link to the English guide, and Choose package folder. To mark a folder manually, create a note named _code-embed-root inside it (filename _code-embed-root.md).

Prompts/
  _code-embed-root.md
  Start.md
  Shared/
    Style.md

Prompts/Start.md → ![Shared/Style:##Tone]

The nearest marker bounds the entire expansion. Short names must be unique. If a name is ambiguous, choose a path from the error message. Paths with a slash start at the package root. Nested packages are separate. Move the folder with its marker to preserve references.

Install the development build

npm run build
npm test

Copy dist/{main.js,manifest.json,styles.css} to .obsidian/plugins/code-embed/.

Commercial use is permitted. When distributing a modified version, include the license, retain the applicable attribution to Jakub Wajda (JavaMiner) from NOTICE and mark the files you changed.

Releases · Apache 2.0 · Jakub Wajda · Buy me a coffee · PayPal · Wise · Revolut

HealthExcellent
ReviewRisks
About
Create reusable prompts and insert expanded code or text snippets from other notes using embed syntax. Inspect embed structure with View, copy expanded output with Copy+, and include exact content via local $[...] tags, section or line ranges, or preserve literal notation with \$[...].
TemplatingCodeDevelopers
Details
Current version
0.2.7
Last updated
12 hours ago
Created
5 days ago
Updates
6 releases
Downloads
43
Compatible with
Obsidian 1.5.0+
Platforms
Desktop, Mobile
License
Apache-2.0
Report bugRequest featureReport plugin
Sponsor
Support
PayPal
Buy Me a Coffee
Author
JavaMinerJavaMinerjavaminer
GitHubjavaminer
  1. Community
  2. Plugins
  3. Templating
  4. Code Embed

Related plugins

CustomJS

Reuse custom JavaScript across desktop and mobile.

Templater

Create and use dynamic templates.

CodeScript Toolkit

Allows to do a lot of things with JavaScript/TypeScript scripts from inside the Obsidian itself

JS Engine

Run JavaScript from within your notes.

BRAT

Easily install a beta version of a plugin for testing.

Claudian

Embeds Claude Code/Codex and other local Agents as AI collaborators in your vault.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

Local REST API with MCP

Unlock your automation needs by interacting with your notes over a secure REST API.

Terminal

Integrate consoles, shells, and terminals.

QuickAdd

Quickly add new notes or content to your vault.