README file from
GithubFeature Overview
This plugin enhances the Obsidian canvas with a wide array of features:
- Core Enhancements:
- Standardized Format: Compatible with the JSON Canvas format, introducing the Advanced JSON Canvas format for enhanced features.
- Full Metadata Cache Support: Integrate canvases with Obsidian's graph view, outgoing links, and backlinks.
- Frontmatter Support: Add custom properties to canvas files.
- Auto File Node Edges: Automatically create edges between file nodes based on their frontmatter properties.
- Single Node Links & Embeds: Link or embed a single node from a canvas into markdown files.
- Better Default Settings: Customize default node sizes, grid alignment, and more.
- Enhanced Readonly Mode: Finer control over canvas interaction in readonly mode.
- Improved Image Export: Export to PNG/SVG with transparency and other options.
- Node Customization:
- Node Styles: Includes various Flowchart Shapes, Border Styles, and Text Alignment.
- Auto Node Resizing: Nodes adapt to their content size automatically.
- Variable Breakpoints: Control content rendering based on zoom level.
- Z-Ordering Control: Manage node stacking order.
- Custom Colors: Add your own colors to the picker.
- Edge Customization:
- Edge Styles: Includes Path Styles (dotted, dashed), Arrow Styles, and Pathfinding Methods.
- Floating Edges: Edges automatically adjust their connection side.
- Flip Edge: Quickly reverse edge direction.
- Interaction & Workflow:
- Canvas Commands: A suite of commands for efficient canvas manipulation.
- Native-Like File Search: Search for text within the whole canvas using a native-like interface.
- Presentation Mode: Create and navigate slide-like presentations.
- Portals: Embed other canvases within your current canvas.
- Collapsible Groups: Organize your canvas with expandable/collapsible groups.
- Edge Highlight: Highlight edges when a connected node is selected.
- Edge Selection: Select edges connected to the selected node(s).
- Focus Mode: Highlight a single node by blurring others.
- Encapsulate Selection: Move selected nodes to a new canvas, linking back to it.
- Create groups independently of the nodes.
- Styling & Extensibility:
- Custom Styles: Add unique CSS-based styles to nodes and edges.
- Canvas Events: Expose canvas events for use in other plugins.
All features can be enabled/disabled in the settings.
Installation
Open the Community Plugins tab in the settings and search for "Advanced Canvas" (or click here).
- Install it using BRAT
- Manual folder creation
- Create a folder named
advanced-canvasin your vault's plugins folder (<vault>/.obsidian/plugins/). - Download
main.js,styles.cssandmanifest.jsonfrom the latest release and put them in theadvanced-canvasfolder. - Enable the plugin in Settings -> Community plugins -> Installed plugins
- Create a folder named
Support
Please consider supporting the plugin. There are many hours of work and effort behind it. The two easiest ways to support the plugin are either by starring ⭐ the repository or by donating any amount on Ko-fi ❤️. Thank you!
Terminology
- Canvas: The canvas view is the view in which nodes and edges are displayed.
- Node: A node is a single element in a canvas that can contain text, files, or links. (Some people also call it card or element - but please always use node.)
- Text Node: A text node is a node that contains text.
- File Node: A file node is a node that contains a link to another file.
- Group Node: A group node is a node that contains other nodes.
- Link Node: A link node is a node that displays a website.
- Edge: An edge is a connection between two nodes in a canvas. It can be used to represent relationships or connections between different elements. (Please always use edge instead of arrow to avoid confusion with the edge arrow.)
- Edge Path: The edge path is just the line that connects two nodes in a canvas.
- Edge Arrow: The edge arrow is the arrow at the end (or start) of an edge that indicates the direction of the connection.
- Popup Menu: The popup menu is the horizontal menu that is visible if one or more canvas elements (nodes or edges) are selected.
- Context Menu: The context menu is menu that is visible if you right-click in a canvas view.
- Control Menu: The control menu is the vertical menu that is visible in the top right corner of a canvas view.
- Card Menu: The card menu is the horizontal menu at the bottom of the canvas view where you can find options to create new nodes.
Standardized Format
Compatible with the JSON Canvas format, the Advanced JSON Canvas format takes it a step further by adding more features and flexibility. The Advanced JSON Canvas format was introduced to provide longevity, readability, interoperability, and extensibility for canvases created with Advanced Canvas.
Full Metadata Cache Support
Advanced Canvas enables .canvas files to be indexed by the metadata cache. This means that there is now full compatibility with the graph view, outgoing links and backlinks. You can even enable (optional) the creation of an outgoing link if two embeds in a canvas are connected by an edge. This feature brings the full power of Obsidian's linking system to the canvas file format.
- The file cache of a
.canvasfile now contains a value for thehashkey (Generated from the filepath) instead of an empty string.- Check the
app.metadataCache.fileCache[<filepath>]object to see the changes.
- Check the
- The metadata cache is located in the
app.metadataCacheobject - the same object that is used by Obsidian for markdown files.- e.g.
app.metadataCache.getCache/app.metadataCache.getFileCachenow works with.canvasfiles. - The
positionobject which is found inside metadata cache entries now contains a new keynodeIdfor.canvasfiles. - The metadata cache entry for a
.canvasfile now contains a new keynodeswhich is an object of type{ [nodeId: string]: MetadataCacheEntry }- this allows for other plugins to access the full metadata cache for single nodes. TheMetadataCacheEntryobject is the same as for markdown files (even created with the same function - 1:1 compatibility).
- e.g.
- The resolved links object now has entries for
.canvasfiles.- The
app.metadataCache.resolvedLinksobject values for.canvasfiles are implemented in the exact same way as for markdown files.
- The
Frontmatter Support
Additionally, Advanced Canvas introduces full frontmatter support for .canvas files. You can now view and edit the frontmatter directly within the canvas view:
- Accessing Frontmatter: Click the "info" icon located in the top right corner of the canvas view.
- Functionality: This allows you to add custom properties (metadata) to your canvas files.
- Use Cases:
- Categorization & Tagging: Add
tagsor custom keys for organization. - Aliases: Use
aliasesto create alternative names for your canvas files. - Styling: Use
cssclassesto apply custom CSS styles to the entire canvas view. - Custom Metadata: Define any other properties relevant to your workflow.
- Categorization & Tagging: Add
- Searchability: Properties defined in the frontmatter of your
.canvasfiles are searchable using Obsidian's global search pane, further integrating canvases into your knowledge management system.
This significantly enhances the ability to manage, organize, and customize your canvases alongside your other notes in Obsidian.
Auto File Node Edges
Advanced Canvas can automatically create edges between file nodes based on their frontmatter properties. By default (if enabled), it will create edges to files linked in the canvas-edges frontmatter property. This allows you to create fixed relationships between file nodes in your canvas, making it easier to visualize fixed structures or connections between different files.
Single Node Links & Embeds
Advanced Canvas now allows you to link or embed the content of a single node from a .canvas file directly into your markdown files. This provides a granular way to reference specific pieces of information within your canvases.
- Syntax:
- Linking: Use the standard wikilink format with the node ID appended after a
#:[[canvas-file-name#node-id]] - Embedding: Use the standard embed wikilink format, also with the node ID:
![[canvas-file-name#node-id]]
- Linking: Use the standard wikilink format with the node ID appended after a
- Functionality: When you link or embed a node this way, the actual content of that specific node from the canvas will be displayed or linked within your markdown file. This is incredibly useful for creating direct references to diagrams, text snippets, or any other content held within individual canvas nodes.
Better Default Settings
- Enforce all new nodes to be aligned to the grid
- Customize default text node size
- Customize default file node size
- Modify the minimum node size
- Disable the font scaling relative to the zoom level
Native-Like File Search
Quickly locate text within your canvas using a familiar search experience. Advanced Canvas integrates a native-like file search specifically for canvas content.
- Activation: Use the
Search current filecommand, which is commonly bound to theCtrl+F(orCmd+Fon macOS) keyboard shortcut. - Functionality: This opens a search interface that allows you to search for text across all nodes within the currently active canvas.
- Benefits: Easily find specific information, navigate to relevant nodes, and streamline your workflow when dealing with text-heavy canvases.
Canvas Commands
Advanced Canvas: Toggle readonly- Toggle the readonly state of the canvas
Advanced Canvas: Create text node- Create a new text node
Advanced Canvas: Create file node- Create a new file node
Advanced Canvas: Group selected nodes- Create a group node around the selected nodes
Advanced Canvas: Toggle collapse group- Collapse/Expand the selected group node
Advanced Canvas: Select all edges- Select all edges
Advanced Canvas: Zoom to selection- Zoom to the bounding box of the selected nodes
Advanced Canvas: Zoom to fit- Zoom to fit all nodes
Advanced Canvas: Navigate up/down/left/right- Navigate through the canvas using the aforementioned commands
Advanced Canvas: Clone node up/down/left/right- Clone the selected node in the direction of the arrow keys
- The cloned node will have the same dimensions and color as the original node
Advanced Canvas: Expand node up/down/left/right- Expand the selected node in the direction of the arrow keys
Advanced Canvas: Flip selection horizontally/vertically- Flip the selected nodes and the respective edges horizontally or vertically
Advanced Canvas: Swap nodes- Swap two selected nodes with each other (x, y and width, height will be swapped)
Advanced Canvas: Copy wikilink to node- Copy the wikilink to the selected node to the clipboard
Advanced Canvas: Pull outgoing links to canvas- Create file nodes for all outgoing links of the selected nodes / the whole canvas if no node is selected
Advanced Canvas: Pull backlinks to canvas- Create file nodes for all backlinks of the selected nodes / the whole canvas if no node is selected
Node Styles
You can customize the default node styles using the settings. This includes various shapes, border styles, and text alignment options.
Node Shapes
Usage
- Use the updated popup menu set a node's shape.
Shapes
Border Styles
Set the style of the border to dotted, dashed or invisible.
(Note: Text Alignment options (Left, Center, Right) are also available for nodes.)
Edge Styles
You can customize the default edge styles using the settings.
Path Styles
Set the style of the edge paths to dotted, short-dashed or long-dashed.
Arrow Styles
Set the style of the arrows to triangle outline, halved triangle, thin triangle, diamond, diamond outline, circle, circle outline and blunted.
Pathfinding Methods
Set the pathfinding method of the edges (arrows) to default, straight, squared or A*.
Custom Styles
Custom style attributes for nodes and edges can easily be added. They get exposed in the .canvas-node dataset (for nodes) or .canvas-edges path dataset (for edges) and can be styled using CSS. Node styles also get exposed in the node editor iframe in the body dataset and the class canvas-node-iframe-body indicating that the body is inside a canvas node iframe.
- Create a new CSS snippet in your vault:
- Navigate to
Settings > Appearance > *scroll down* > CSS snippetsand click on the folder icon to open the snippets folder. - Create a new CSS file (e.g.
my-fancy-node-style.css).
- Navigate to
- Add the custom style attribute definition:
- Open the CSS file and add the following code. The format needs to be YAML (within a CSS comment) and must contain the same keys as in this example. The number of options can be adjusted (minimum of one option is required). The
iconkey should contain the ID of an icon from lucide.dev. - Change
@advanced-canvas-node-styleto@advanced-canvas-edge-stylefor edge styles.
/* @advanced-canvas-node-style key: validation-state label: Validation State options: - label: Stateless value: null icon: circle-help - label: Approved value: approved icon: circle-check - label: Pending value: pending icon: circle-dot - label: Rejected value: rejected icon: circle-x */ - Open the CSS file and add the following code. The format needs to be YAML (within a CSS comment) and must contain the same keys as in this example. The number of options can be adjusted (minimum of one option is required). The
[!IMPORTANT] There needs to be one option with the value
null.
- Add the CSS styling:
- In the same (or another) CSS file, add the styling for your custom attribute.
/* General structure */ .canvas-node[data-<YOUR-CUSTOM-STYLE-KEY>="<VALUE>"] { /* Your custom styling */ }- Example for
validation-state:
.canvas-node[data-validation-state] .canvas-node-content::after { content: ""; position: absolute; top: 10px; right: 10px; font-size: 1em; } .canvas-node[data-validation-state="approved"] .canvas-node-content::after { content: "✔️"; } .canvas-node[data-validation-state="pending"] .canvas-node-content::after { content: "⏳"; } .canvas-node[data-validation-state="rejected"] .canvas-node-content::after { content: "❌"; } - Enable the CSS snippet in Obsidian's settings and enjoy your new custom style attribute!
See an example of a complete custom node style CSS file here.
Variable Breakpoints
Add breakpoints to nodes to change at which zoom factor the node's content gets unrendered.
[!IMPORTANT] Due to performance reasons, custom breakpoints get cached and are only re-fetched when the canvas gets reloaded. Changes in the CSS snippet won't be applied immediately (only after reopening the canvas).
Create a new CSS snippet in your vault (and enable it in settings):
/* Any CSS selector can be used (As long as the .canvas-node element has the CSS variable defined) */
.canvas-node[data-shape="pill"] {
/* The zoom factor at which the node's content gets unrendered (Zoom level can range from 1 to -4) */
--variable-breakpoint: 0.5;
}
Z-Ordering Control
Change z-ordering of nodes using the context menu.
Custom Colors
Add custom colors to the color picker. You can add them using the following CSS snippet:
body {
/* Where X is the index of the color in the palette (1-6 are used by Obsidian) */
--canvas-color-X: 0, 255, 0; /* RGB values */
}
Presentation Mode
In presentation mode, you can navigate through nodes using arrow keys or PageUp/PageDown keys (compatible with most presentation remotes). Slides/nodes are connected by arrows. For multiple outgoing arrows from one node, number them to define navigation order. While in presentation mode, the canvas is in readonly mode (so Better Readonly features apply). Exit with ESC or the corresponding command. Use Advanced Canvas: Continue presentation to resume from the last slide.
More Complex Example
Usage
- Create the first slide:
- Use the updated popup menu to mark a node as the first slide.
- OR create a node and mark it via the updated card menu.
- Add more slides:
- Link slides using arrows.
- To loop back, number arrows for navigation order.
- TIP: Use the updated card menu for consistent slide dimensions.
- Control the presentation:
- Start: Command Palette (
Advanced Canvas: Start presentation). - Navigate: Arrow keys.
- Exit:
ESCkey.
- Start: Command Palette (
Portals
Embed other canvases inside your current canvas and create edges (arrows) to the embedded canvas.
Usage
- Embed a canvas file, then click the door icon in the popup menu to open it as a portal.
Collapsible Groups
Collapse and expand groups to organize your canvas.
Image Export
Export the whole canvas or just a selection as a PNG/SVG image with transparency. Core plugin export options like "Privacy Mode" and "Show Logo" (extended to include Advanced Canvas logo) are also available.
Auto Node Resizing
Resize nodes automatically when their text content changes. Toggle this feature per-node using the updated popup menu.
Edge Highlight
Highlight edges when a connected node is selected. This feature helps to visually identify relationships between nodes.
If you want to edit the look of the highlighted edges, you need to edit the is-focused CSS class in a custom CSS snippet.
Focus Mode
Focus on a single node by blurring all other nodes.
If "Edge Highlight" is enabled, edges connected to the focused node won't be blurred.
Better Readonly
- Disable node popup menus.
- Lock the canvas' position.
- Lock the canvas' zoom.
- Interactivity is retained for zooming to a bounding box (e.g., zoom to selection, zoom to fit all).
Usage
- Use the updated control menu to toggle these features (shown only if the canvas is in readonly mode).
Encapsulate Selection
Move the current selection to a new canvas and create a link to it in the current canvas.
Usage
- Select the nodes you want to encapsulate.
- Use the context menu (right-click) to encapsulate the selection.
- OR use the command palette (
Advanced Canvas: Encapsulate selection).
Floating Edges (Automatic Edge Side)
Edges automatically change their connection side to the most suitable one. Drag the edge to the indicated drop zone inside the node to make the edge float.
Flip Edge
Flip the direction of an edge with one click.
Edge Selection
Select edges connected to the selected node(s).
Select By Direction
Select incoming or outgoing edges of the selected node(s).
Note: this requires the setting Edge Selection > Select Edge By Direction to be enabled.
Canvas Events
All custom events are prefixed with advanced-canvas: and can be listened to using app.workspace.on (just like default Obsidian events).
Check out the list of events here.
Settings
Every feature can be enabled/disabled in the settings. All features were made to be as customizable as possible.
Contributing
All code contributions that aren't made by LLMs or just update the README are welcome!
You may want to check out issues with the PRs appreciated label to find issues you can start with.
But feel free to work on any issue or non-issue you want to work on!