A drawing is named by its file, not by the plugin's # Excalidraw Data - #509
Merged
Conversation
Every `.excalidraw.md` the Obsidian plugin writes opens with `# Excalidraw Data` — the container heading for the sections beneath it. `noteHeading`'s middle rung is meant to catch a document naming itself, and it caught that instead: the breadcrumb, the tab and the inline title all read "Excalidraw Data", for every drawing in every context. The reader cannot even see the heading it was named after. A drawing opens in `DrawingView` or the editor page, so the Markdown half is never on screen — which means the collision that rung exists to avoid cannot happen here, and `noteHeadingSource` reporting "heading" merely suppressed the one line that would have named the file. So a drawing skips that rung and is named from its path, through `drawingName` rather than a `.md` trim: a drawing carries two extensions, and the old trim left `plan.excalidraw` in the band. The same function now names the title, the breadcrumb leaf and the tab label, so the three cannot disagree — and the tab strip's collision test runs on the same name, so `plan.md` and `plan.excalidraw.md` no longer open as two identical-looking tabs. The frontmatter rung above is untouched: a `title:` somebody typed still wins. Sabotage-tested by writing the assertions first and watching each fail against the old code — 2 in `frontmatter.test.ts`, 1 in `breadcrumbPath.test.ts`, 2 in `fileTabs.test.ts`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Aw5rqhqSUjVU8LoX2HFkPE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every drawing in the console was called Excalidraw Data.
noteHeading's middle rung catches a document naming itself with an opening# Heading. Every.excalidraw.mdthe Obsidian plugin has ever written opens with# Excalidraw Data— the container heading for the sections beneath it — so that rung read the plugin's scaffolding and named the format instead of the file, in the breadcrumb, the tab and the inline title, for every drawing in every context.The reader cannot even see the heading it was named after: a drawing opens in
DrawingViewor the editor page, so the Markdown half is never on screen. The collision that rung exists to avoid — a title above the same# H1— cannot happen here, andnoteHeadingSourcereporting"heading"merely suppressed the one line that would have named the file.What changed
noteHeadingskips the heading rung for a drawing path and names it from the file.noteHeadingSourcetakes an optionalpathand answers"filename"for one, so the inline title is drawn rather than stepping aside.drawingName, not a.mdstrip — a drawing carries two extensions, and the old trim leftplan.excalidrawin the band. The same function now names the title, the breadcrumb leaf (crumbsFor) and the tab label (tabLabel), so the three cannot come to disagree.tabLabel's collision test runs on that same name, soplan.mdandplan.excalidraw.mdopen as two tabs that say which is which rather than two that look identical.title:somebody typed still wins, for a drawing exactly as for a note.docs/decisions/obsidian-plugins.mdwith what a simplification of it costs.Self-review
crumbsFor's trim is applied to the leaf only, unchanged — a folder callednotes.mdorplan.excalidraw.mdkeeps its own spelling, and there is a case for both.drawingName("")anddrawingName(".md")return"", exactly as the oldreplace(/\.md$/i, "")did, so the "never returns an empty string" floor below is reached on the same inputs as before..excalidraw.md) falls past the drawing rung to the basename rather than back to the heading — the branch is written as an either/or for that reason, so "a drawing is never named by its body" holds with no exception.noteHeadingSource'spathis optional becauseNoteEditorcan ask before the editor holds one; the drawing answer is the only thing it changes.baseNameis still used bytabLabel's folder disambiguation, so the import stays.Tests
Written first, each watched failing against the old code: 2 in
frontmatter.test.ts(the container heading naming the note; the title stepping aside), 1 inbreadcrumbPath.test.ts(request-path.excalidrawin the band), 2 infileTabs.test.ts(both extensions; the collision withplan.md). Plus a case pinning that an ordinary note is untouched.apps/mobile: 5,321 checks across 280 suites green, typecheck and lint clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Aw5rqhqSUjVU8LoX2HFkPE
Generated by Claude Code