Skip to content

A drawing is named by its file, not by the plugin's # Excalidraw Data - #509

Merged
lilseyi merged 1 commit into
mainfrom
claude/elegant-maxwell-ph8akg
Sep 13, 2026
Merged

A drawing is named by its file, not by the plugin's # Excalidraw Data#509
lilseyi merged 1 commit into
mainfrom
claude/elegant-maxwell-ph8akg

Conversation

@lilseyi

@lilseyi lilseyi commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Every drawing in the console was called Excalidraw Data.

noteHeading's middle rung catches a document naming itself with an opening # Heading. Every .excalidraw.md the 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 DrawingView or 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, and noteHeadingSource reporting "heading" merely suppressed the one line that would have named the file.

What changed

  • noteHeading skips the heading rung for a drawing path and names it from the file. noteHeadingSource takes an optional path and answers "filename" for one, so the inline title is drawn rather than stepping aside.
  • The trim is drawingName, not a .md strip — 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 (crumbsFor) and the tab label (tabLabel), so the three cannot come to disagree.
  • tabLabel's collision test runs on that same name, so plan.md and plan.excalidraw.md open as two tabs that say which is which rather than two that look identical.
  • The frontmatter rung above is untouched: a title: somebody typed still wins, for a drawing exactly as for a note.
  • Recorded in docs/decisions/obsidian-plugins.md with what a simplification of it costs.

Self-review

  • crumbsFor's trim is applied to the leaf only, unchanged — a folder called notes.md or plan.excalidraw.md keeps its own spelling, and there is a case for both.
  • drawingName("") and drawingName(".md") return "", exactly as the old replace(/\.md$/i, "") did, so the "never returns an empty string" floor below is reached on the same inputs as before.
  • A drawing whose name is empty (.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's path is optional because NoteEditor can ask before the editor holds one; the drawing answer is the only thing it changes.
  • baseName is still used by tabLabel'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 in breadcrumbPath.test.ts (request-path.excalidraw in the band), 2 in fileTabs.test.ts (both extensions; the collision with plan.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

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
@lilseyi
lilseyi merged commit 174712f into main Sep 13, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants