by Mouiz LANIKPEKOUN
Switch Markdown file cards in a canvas between an editable preview and a compact link. Requires the Advanced Canvas plugin.
Canvas Card View
Switches the Markdown file cards of a canvas between their editable preview and a compact link, one card at a time or for the whole canvas. A dense canvas becomes a navigation map; a card you want to edit goes back to its preview in one click.
The card is never converted: it stays a native file card, so its edges, its note identity and its backlinks are untouched. Only its presentation changes.
Requires the Advanced Canvas plugin (advanced-canvas), version 7 or later. Canvas Card View adds its controls through Advanced Canvas and has nothing to attach to without it.
Using it
- One card: select a single Markdown file card. Its floating menu gets a button that switches it to a link (
[[Note name]]) and back. - Whole canvas: a button in the canvas controls sends every Markdown card to a link if any card is still a preview, and restores every preview if all are links.
- Opening a note: click the link to open the note; Ctrl or Cmd click, or the middle button, opens it in a new tab.
Only Markdown file cards are affected. PDF, image, group, text and web cards are left alone.
What is guaranteed
- Presentation only. Note content is never changed and card types are never converted.
- A locked canvas is never modified. The canvas-wide control is hidden and the card control does nothing while a canvas is read-only.
- One undo step and one save per action, however many cards change.
- A missing note is reported, not created. A card whose note no longer exists shows its link as unresolved; clicking it says so instead of opening an empty note.
- Unambiguous links. The text is the shortest one that names the note, as Obsidian would write it, so two notes with the same name in different folders stay distinguishable.
How it is saved
The state is stored per card in the canvas file, in the card's styleAttributes:
{ "type": "file", "file": "Notes/Plan.md", "styleAttributes": { "cardView": "link" } }
A card in its preview has no cardView entry, and a canvas that never used the plugin is unchanged. Other style attributes on the card are kept.
Limits
- The plugin relies on Advanced Canvas events and on internal objects of the core Canvas (
canvas.nodes,node.getData(), the floating menu and the canvas controls). An update of either can break it. - It has no settings: the behavior is meant to stay predictable.
Install
Not in the community directory yet. To install by hand, build it (below), copy main.js, manifest.json and styles.css into <vault>/.obsidian/plugins/canvas-card-view/, and enable it next to Advanced Canvas.
Development
npm install
npm test # model and controller, under jsdom, against a fake canvas
npm run lint # the official Obsidian ESLint rules
npm run build # type-check, then bundle main.js
npm run deploy -- <vault>/.obsidian/plugins/canvas-card-view
src/model.ts holds the data rules and the saved format. src/controller.ts holds the toggles, the overlays and the safety rules, and has no Obsidian import: everything the app provides comes through a small interface, which is what lets the tests run it. src/main.ts is the Obsidian side.
License
MIT
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.