by JavaMiner
Expand reusable note fragments and preview structured prompts.
Code Embed · Development version guide
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
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.