diff --git a/manifest-beta.json b/manifest-beta.json
index c05cc44..5d81163 100644
--- a/manifest-beta.json
+++ b/manifest-beta.json
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
- "version": "2.14.1-beta-1",
+ "version": "2.14.1-beta-2",
"minAppVersion": "1.5.7",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
diff --git a/package.json b/package.json
index 04d8671..ba4aaf6 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.8",
- "@zsviczian/excalidraw": "0.18.0-26",
+ "@zsviczian/excalidraw": "0.18.0-27",
"chroma-js": "^3.1.2",
"clsx": "^2.0.0",
"@zsviczian/colormaster": "^1.2.2",
diff --git a/src/constants/constants.ts b/src/constants/constants.ts
index bae7597..637f78a 100644
--- a/src/constants/constants.ts
+++ b/src/constants/constants.ts
@@ -262,6 +262,7 @@ export const FRONTMATTER_KEYS:{[key:string]: {name: string, type: string, depric
"iframe-theme": {name: "excalidraw-iframe-theme", type: "text", depricated: true},
"embeddable-theme": {name: "excalidraw-embeddable-theme", type: "text"},
"open-as-markdown": {name: "excalidraw-open-md", type: "checkbox"},
+ "embed-as-markdown": {name: "excalidraw-embed-md", type: "checkbox"},
};
export const CaptureUpdateAction = {
diff --git a/src/core/managers/MarkdownPostProcessor.ts b/src/core/managers/MarkdownPostProcessor.ts
index 070863c..c7dbd3b 100644
--- a/src/core/managers/MarkdownPostProcessor.ts
+++ b/src/core/managers/MarkdownPostProcessor.ts
@@ -710,7 +710,7 @@ const isTextOnlyEmbed = (internalEmbedEl: Element):boolean => {
if(!src) return true; //technically this does not mean this is a text only embed, but still should abort further processing
const fnameParts = getEmbeddedFilenameParts(src);
return !(fnameParts.hasArearef || fnameParts.hasGroupref || fnameParts.hasFrameref || fnameParts.hasClippedFrameref) &&
- (fnameParts.hasBlockref || fnameParts.hasSectionref)
+ (fnameParts.hasBlockref || fnameParts.hasSectionref) && fnameParts.blockref !== "as-image"
}
const tmpObsidianWYSIWYG = async (
@@ -724,6 +724,9 @@ const tmpObsidianWYSIWYG = async (
const file = app.vault.getAbstractFileByPath(ctx.sourcePath);
if(!(file instanceof TFile)) return;
if(!plugin.isExcalidrawFile(file)) return;
+ if(ctx.frontmatter?.["excalidraw-embed-md"]) {
+ return;
+ }
//@ts-ignore
if (ctx.remainingNestLevel < 4) {
diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts
index 28396d9..2cd9a0d 100644
--- a/src/lang/locale/en.ts
+++ b/src/lang/locale/en.ts
@@ -419,7 +419,8 @@ FILENAME_HEAD: "Filename",
SHOW_DRAWING_OR_MD_IN_HOVER_PREVIEW_DESC:
"...even if the file has the excalidraw-open-md: true frontmatter key.
" +
"When this setting is off and the file is set to open in md by default, the hover preview will show the " +
- "markdown side of the document.",
+ "markdown side of the document.
" +
+ "Note: excalidraw-open-md is different from excalidraw-embed-md. If excalidraw-embed-md is set to true, the hover preview will always show the markdown side, regardless of this setting. To force image rendering when embedding, use ![[drawing#^as-image]] in your markdown file.",
SHOW_DRAWING_OR_MD_IN_READING_MODE_NAME: "Render as image when in markdown reading mode of an Excalidraw file",
SHOW_DRAWING_OR_MD_IN_READING_MODE_DESC:
"When you are in markdown reading mode (aka. reading the back side of the drawing) should the Excalidraw drawing be rendered as an image? " +
diff --git a/src/shared/Dialogs/Messages.ts b/src/shared/Dialogs/Messages.ts
index 141c7bb..423bf85 100644
--- a/src/shared/Dialogs/Messages.ts
+++ b/src/shared/Dialogs/Messages.ts
@@ -19,8 +19,10 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
`,
"2.14.1":`
## New
+- New frontmatter option \`excalidraw-embed-md\`. When set to \`true\`, embedding this Excalidraw file into another markdown file will display its markdown content (the "back of the note") instead of rendering it as an image.
+ - If you want to always display the drawing as an image, even when \`excalidraw-embed-md\` is enabled, use the special embed syntax: \`![[drawing#^as-image]]\`. Here, \`as-image\` is a phantom block reference that forces image rendering.
- Added Spanish translation by [@Joakim31](https://github.com/Joakim31) [#2425](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2425)
-- Incremental minor updates from the main Excalidraw project.
+- Incremental minor updates from the main [Excalidraw project](https://github.com/excalidraw/excalidraw).
## Fixed
- Styling issues impacting native Obsidian search/replace dialogs. [#2420](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2420)
diff --git a/src/shared/Dialogs/SuggesterInfo.ts b/src/shared/Dialogs/SuggesterInfo.ts
index 2418b19..62c91f0 100644
--- a/src/shared/Dialogs/SuggesterInfo.ts
+++ b/src/shared/Dialogs/SuggesterInfo.ts
@@ -1067,6 +1067,13 @@ export const FRONTMATTER_KEYS_INFO: SuggesterInfo[] = [
desc: "If this key is present the file will be opened as a markdown file in the editor",
after: ": true",
},
+ {
+ field: "embed-md",
+ code: null,
+ desc: "If this key is present, when embedding the ![[image]] into a markdown document, it will be embedded as markdown, not as an image.\n" +
+ "If however you embed ![[image#^as-image]], i.e. you reference the 'as-image' block, then the image will be embedded as an image.",
+ after: ": true",
+ },
{
field: "autoexport",
code: null,