BUG: Embedded drawing sometimes renders as an empty gap permanently
Have you searched for existing issues (including closed ones)?
- Yes, I have searched the existing issues.
Does this bug persist in a new vault with only Excalidraw installed?
- Yes, I have verified the issue persists.
Your environment
Output of Command Palette -> "Show debug info":
SYSTEM INFO: Obsidian version: 1.13.7 Installer version: 1.13.7 Operating system: Windows 10 Pro 10.0.19045 Login status: not logged in Language: zh Insider build toggle: off Live preview: on Base theme: dark Community theme: none Snippets enabled: 1 Restricted mode: off Plugins installed: 16 Plugins enabled: 11 1: Attachment Management v0.12.1 2: Checklist v2.2.14 3: Editing Toolbar v4.1.4 4: Excalidraw v2.27.3 5: Style Settings v1.0.9 6: Claudian v2.3.3 7: Tasks v8.4.0 8: Nutstore Sync v1.5.0 9: Clear Unused Images v1.1.1 10: Notebook Navigator v3.4.3 11: Apex Dashboard v3.6.3
Your NotebookLM query
Question asked: "In the Obsidian Excalidraw plugin, an embedded drawing in a markdown note sometimes renders as an empty gap permanently: the embed element keeps a 'ready' attribute and its content stays empty, and it never recovers. Which settings, known issues or behaviours relate to embedded drawings failing to render in markdown notes, and is there a supported way to force an embed to re-render?"
NotebookLM answer: Several settings, known behaviors, and file-handling mechanics in the Obsidian Excalidraw plugin can cause embedded drawings in Markdown notes to render as empty gaps or fail to update:
Known Settings, Issues, and Behaviors Related to Blank Embeds
- Image Caching Settings:
- Cache images for embedding in markdown: When this setting is turned on in Plugin Settings > Embed & Export, Excalidraw uses cached image renders for Markdown embeds. If the underlying drawing or nested elements change, the Markdown embed will not update or re-render until you explicitly open and save the source drawing to update the cache.
- Cache nested Excalidraws in Scene: When scenes contain deeply nested Excalidraw drawings, scene caching can occasionally fail to detect child updates, requiring cache clearing.
- Export & Preview Settings:
- If found, use the already exported image for preview: When active under Embed & Export, Obsidian relies on previously exported SVG or PNG files for previews rather than generating new previews on the fly. If auto-export is disabled, out of sync, or missing, the command palette or embed renderer may insert a broken or empty link.
- Markdown Preview Image Type:
- Embedded drawings can be rendered using Native SVG, SVG Image, or PNG Image. Selecting PNG Image disables certain area-selection and block-referencing features, which can prevent specific section transclusions from rendering properly.
- Markdown Commenting (
%%) and Block Indexing:- Placing Markdown comment markers (
%%) directly above# Text Elementsor# Excalidraw Datacauses Obsidian to stop indexing text elements and block references within the drawing. If a Markdown embed references a specific block or section ID from that drawing, the transclusion will fail to resolve.
- Placing Markdown comment markers (
- Linter & Auto-Formatting Conflicts:
- Automatic linter plugins that alter line spacing or section headers in Markdown files can corrupt the structure under
## Text Elementsor## Drawing, causing Excalidraw to load an empty drawing or fail to parse data.
- Automatic linter plugins that alter line spacing or section headers in Markdown files can corrupt the structure under
- Obsidian View Refresh Timing:
- Obsidian sometimes experiences a timing delay where it fails to recognize that an auto-exported SVG/PNG file has been updated in the background, leaving a blank or missing placeholder in the active note view even though the underlying file exists.
Supported Ways to Force an Embed to Re-Render
To resolve an unrendered or blank embed, you can use the following supported actions and workflows:
- Purge Cache:
- Navigate to Excalidraw Settings > Embed & Export > Image caching and rendering optimization and click the Purge Cache button to force Excalidraw to clear stored image renders.
- Force-Save the Source Drawing:
- Open the original Excalidraw file and trigger a force-save by pressing
Control + S(orCommand + S) or by clicking the Force Save button in the Obsidian tools panel. This updates auto-exported SVG/PNG files and refreshes the Markdown embed cache.
- Open the original Excalidraw file and trigger a force-save by pressing
- Navigate Away and Back:
- Switch away from the active Markdown note to another tab/file and navigate back. This forces Obsidian to reload the active view and re-render updated preview elements.
- Close and Re-open the Document:
- Close the active Markdown note or Excalidraw tab and reopen it to force the plugin and Obsidian view processors to re-initialize.
- Command Palette Recovery Actions:
Excalidraw: Open Excalidraw drawing: Highlight the embed line or link in the Markdown note and run this command to open the source drawing directly for editing and re-saving.Excalidraw: Find SVG and PNG exports that are out of date: Scans your vault for out-of-date image exports so you can open and re-save them.Excalidraw: Decompress current Excalidraw file: If JSON compression causes Markdown view parsing issues, decompressing the file allows you to inspect or restore compressed Excalidraw JSON data.
Would you like to explore how frontmatter document properties or auto-export settings can be configured to keep your drawings updated automatically across Markdown notes?
Cross-check of the answer above against this case (so it is visible where it does not apply):
- "Cache images for embedding / stale cache" — not applicable. The cached entry for the failing drawing exists, is fresh (the entry's mtime is newer than the drawing's mtime), and its blob reads correctly; the embed's render task does reach the cached blob, so the failure happens after the cache. Purge Cache was tried: I cleared the image cache (imageCacheV2 / imageCacheAccessV2 stores, 13 entries each) and re-ran the repro twice — the blank embed still occurred both times and stayed blank (only an external re-render recovers it). Clearing the cache does not fix this bug.
- "If found, use the already exported image for preview" — not applicable: that setting is off in my vault and there are no exported SVG/PNG files (I checked the vault).
- "PNG preview image type disables block/area refs" — not applicable: I use SVGIMG, and my embeds reference whole drawings (no blockref/sectionref at all).
- "
%%above# Text Elementsbreaks indexing" — not applicable: my drawings use the plugin's standard layout, and the embeds carry no block/section references. - "Linter / auto-formatting corrupting the file" — not applicable: no Linter/formatter plugin is installed, and the drawing files decompress to valid scenes and export fine.
- "View refresh timing delay leaves a blank placeholder even though the file exists" — the closest item, but the remedies it lists were already tried and do NOT recover the embed: navigating away and back, and closing/re-opening the document (repeatedly). Force-saving the source drawing, checking out-of-date exports, and decompressing the file also do not apply — the drawing saves, renders and exports fine, and it intentionally uses compressed-json that decompresses without error.
Describe the bug
An ![[drawing.excalidraw]] embed in a markdown note sometimes renders as an empty gap and never
recovers. The element stays like this:
<div class="internal-embed is-loaded media-embed image-embed" ready="" src="…excalidraw" …></div>with empty innerHTML. It does NOT recover by scrolling away/back, moving the cursor in and out,
switching notes, reopening the note, or copying the whole note content into a new file. Which
embed gets hit varies between renders: in my vault 2.太阳对地球的影响.md line 25 failed stably
while line 37 of the same note failed at other times, and in 3.地球的历史.md (lines 26/27 embed
the same drawing twice) which of the two was blank changed between two renders a few minutes
apart. So it is not tied to one note, one drawing or one link. Embed size (|1500) makes no
difference.
Steps to reproduce
- Have a note that contains a large embedded note (renders asynchronously, thousands of
characters) with one or more
.excalidrawembeds further down (see attachment). - Open the note — i.e. a fresh render of the note. It is a race, not 100% deterministic: in my vault it reproduces within a few attempts, most often on the first Excalidraw embed below the large embed. Reopening the note repeatedly is the most reliable way to hit it.
- Observe the blank embed: the empty element carries
readyand is never retried; scrolling it into view, reopening the note, or copying the note to a new file does not help.
Expected behavior
The embedded drawing renders fine
Additional context
AI-assistance disclosure: the code-level analysis below was produced with AI assistance (Claude, running inside my vault); the reproduction (including in the fresh vault) and the symptom were verified by me on my machine (screenshots attached). Happy to run tests, gather logs, or try a candidate fix.
What is verified NOT the cause (not a link/file/cache problem):
- The link resolves (
metadataCache.getFirstLinkpathDest) and the target is a valid drawing: lz-string decompresses to a valid scene andExcalidrawAutomate.createSVG(path,…)renders it fine (28 KB SVG, viewBox 434x476). - The image-cache entry exists, is not stale, and its blob is readable (
blob.text()returns the SVG); purging the cache is therefore not expected to help. - Traced in the developer console (patched console / IndexedDB): the embed's render task DOES run
and reaches
getImageCache().getImageFromCache(...)->blobToDataURL(cachedBlob). The render result simply never gets appended. - Changing the embed element's
altattribute manually in the console re-renders it successfully (your own MutationObserver intmpObsidianWYSIWYGhandles it), so the render pipeline is healthy — only the hand-off is lost.
Suspected cause (please verify) — in tmpObsidianWYSIWYG (processReadingMode has the same
shape):
if (el.empty(), o.hasAttribute("ready")) return;
o.setAttribute("ready", ""), o.empty();
await getGlobalTaskQueue(plugin).addTask(async () => {
if (!o.isConnected) return;
const e = await processInternalEmbed(o, r);
e && (o.isConnected ? o.appendChild(e) : discardImage(e));
});readyis set BEFORE the async render and never cleared, so every later pass returns early on it — a single lost render is permanent, there is no retry.- The finished render is silently discarded when the element is temporarily disconnected
(
discardImage). Live Preview regularly unmounts/remounts block widgets while the document re-lays out (e.g. while the large embedded note above finishes rendering), so "element disconnected at the wrong moment" is an expected condition, not an error.
Attachments
Source: zsviczian/obsidian-excalidraw-plugin