Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developer-mike/obsidian-advanced-canvas

⚡ Supercharge your Obsidian.md canvas experience! Create presentations, flowcharts and more!
https://github.com/developer-mike/obsidian-advanced-canvas

obsidian obsidian-md obsidian-plugin obsidian-plugins

Last synced: 6 days ago
JSON representation

⚡ Supercharge your Obsidian.md canvas experience! Create presentations, flowcharts and more!

Awesome Lists containing this project

README

        




Logo



Advanced Canvas for Obsidian.md


GitHub star count
Open issues on GitHub



GPL-3.0 license



⚡ Supercharge your canvas experience! Create presentations, flowcharts and more!

## Installation
Open the Community Plugins tab in the settings and search for "Advanced Canvas" (or click [here](https://obsidian.md/plugins?id=advanced-canvas)).

Other installation methods



  • Install it using BRAT

  • Manual folder creation

    1. Create a folder named advanced-canvas in your vault's plugins folder (<vault>/.obsidian/plugins/).

    2. Download main.js, styles.css and manifest.json from the latest release and put them in the advanced-canvas folder.

    3. Enable the plugin in Settings -> Community plugins -> Installed plugins



## Features
All features can be enabled/disabled in the settings.

- Expose node data to style them using CSS
- [Full Metadata Cache support](#full-metadata-cache-support)
- See embedded files and links of the canvas in the **graph view**, **outgoing-links** and **backlinks**
- [Better default settings](#better-default-settings)
- More [canvas commands](#canvas-commands)
- [Node Styles](#node-styles)
- (Flowchart) [Node Shapes](#node-shapes)
- Terminal shape
- Process shape
- Decision shape
- Input/Output shape
- On-page Reference shape
- Predefined Process shape
- Document shape
- Database shape
- [Border Styles](#border-styles)
- Dotted
- Dashed
- Invisible
- Text Alignment
- Left
- Center
- Right
- [Edge Styles](#edge-styles)
- [Path Styles](#path-styles)
- Dotted
- Short-dashed
- Long-dashed
- [Arrow Styles](#arrow-styles)
- Triangle Outline
- Halved Triangle
- Thin Triangle
- Diamond
- Diamond Outline
- Circle
- Circle Outline
- [Pathfinding Methods](#pathfinding-methods)
- Default
- Straight
- Square
- A*
- Add [custom styles](#custom-styles) to nodes and edges for unlimited possibilities
- Add [per-node breakpoints](#variable-breakpoints) to change at which zoom factor the node's content gets unrendered
- [Z-Ordering control](#z-ordering-control) for nodes to control their stacking order
- [Custom colors](#custom-colors) in the color picker
- [Presentation mode](#presentation-mode)
- Create presentations by connecting nodes with arrows
- [Portals](#portals)
- Embed other canvases inside your canvas
- Create edges (arrows) to the embedded canvas
- [Collapsible groups](#collapsible-groups)
- Collapse and expand groups to organize your canvas
- [Auto node resizing](#auto-node-resizing)
- Resize nodes automatically when the text content changes
- [Focus mode](#focus-mode)
- Focus on a single node and blur all other nodes
- [Better readonly](#better-readonly)
- Disable node popup menus
- Lock the canvas' position
- Lock the canvas' zoom
- [Flip edge](#flip-edge)
- Flip the direction of an edge with one click
- [Encapsulate selection](#encapsulate-selection)
- Create a new canvas from the selected nodes
- Create a link to the new canvas in the current canvas
- Create groups independently of the nodes
- Expose [canvas events](#canvas-events) to use them in other plugins

## 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](https://ko-fi.com/X8X27IA08) ❤️. Thank you!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/X8X27IA08)
Time Spent

## 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.

Metadata Cache Support Example
Metadata Cache Support Example

Outgoing Link Using An Edge Example
Outgoing Link Using An Edge Example

### Technical Details
- The file cache of a .canvas file now contains a value for the hash key (Generated from the filepath) instead of an empty string
- Check the `app.metadataCache.fileCache[]` object to see the changes
- The metadata cache is located in the `app.metadataCache` object - the same object that is used by Obsidian for markdown files
- e.g. `app.metadataCache.getCache`/`app.metadataCache.getFileCache` now works with .canvas files
- The `position` object which is found inside metadata cache entries now contains a new key `nodeId` for .canvas files
- The metadata cache entry for a .canvas file now contains a new key `nodes` which is an object of type `{ [nodeId: string]: MetadataCacheEntry }` - this allows for other plugins to access the full metadata cache for single nodes. The `MetadataCacheEntry` object is the same as for markdown files (even created with the same function - 1:1 compatibility)
- The resolved links object now has entries for .canvas files
- The `app.metadataCache.resolvedLinks` object values for .canvas files are implemented in the exact same way as for markdown files

## 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

## Canvas Commands
- `Advanced Canvas: Open Quicksettings`
- Open the quicksettings menu
- `Advanced Canvas: Create text node`
- Create a new text node
- `Advanced Canvas: Create file node`
- Create a new file 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: 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

## Node Styles
You can customize the default node styles using the settings.

### Node Shapes

Flowchart Example
Flowchart Example

#### Usage
- Use the updated popup menu set a node's shape

#### Shapes

Terminal Shape
Terminal Shape

Process/Center Shape
Process/Center Shape

Decision Shape
Decision Shape

Input/Output Shape
Input/Output Shape

On-page Reference Shape
On-page Reference Shape

Predefined Process Shape
Predefined Process Shape

Document Shape
Document Shape

Database Shape
Database Shape

### Border Styles
Set the style of the border to dotted, dashed or invisible.

Border Styles Example
Border Styles Example

## 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.

Edge Styles Example
Edge Path Styles Example

### Arrow Styles
Set the style of the arrows to triangle outline, halved triangle, thin triangle, diamond, diamond outline, circle or circle outline.

Arrow Styles Example
Edge Arrow Styles Example

### Pathfinding Methods
Set the pathfinding method of the edges (arrows) to default, straight, squared or A*.

Path Styles Example
Edge Pathfinding Methods Example

## Custom Styles
Custom style attributes for nodes and edges can easily be added.

1. Add a popup menu option
- Open the `/.obsidian/plugins/advanced-canvas/data.json` file
- If you want to add an option to node popup menu, search for `customNodeStyleAttributes` property, otherwise search for `customEdgeStyleAttributes` property. (Create it if it doesn't exist yet)
- Add the custom popup menu option (Remove the comments!)
```json
"customNodeStyleAttributes": [
{
"datasetKey": "exampleStyleAttribute", // Must be unique and written in camelCase
"label": "Example Style Attribute",
"options": [
{
"icon": "cloud-sun", // Choose an icon from lucide.dev
"label": "Sunny Appearance",
"value": null // Null means default
},
{
"icon": "cloud-rain-wind", // Choose an icon from lucide.dev
"label": "Rainy Appearance",
"value": "rainy" // The value that gets set
}
]
}
// You can add more categories here
]
```

> [!IMPORTANT]
> There needs to be **one** option with the value null

2. Create a new CSS snippet in your vault (And enable it in the settings)
```css
.canvas-node[data-="rainy"] { /* The dataset key is now written in kebab-case */
background-color: #7f7f7f;
}
```
3. Reload Obsidian and enjoy your new custom style!

Custom Style Attribute Example

## Variable Breakpoints
Add breakpoints to nodes to change at which zoom factor the node's content gets unrendered.

Create a new CSS snippet in your vault (And enable it in the settings)
```css
/* 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 reach from 1 to -4) */
--variable-breakpoint: 0.5;
}
```

## Z-Ordering Control
Change z-ordering of nodes using the context menu.

Z-Ordering Control Example
Z-Ordering Control Example

## Custom Colors
Add custom colors to the color picker. You can add them using the following css snippet:
```css
:root {
/* Where X is the index of the color in the palette */
/* The colors 1-6 are already used by Obsidian */
--canvas-color-X: 0, 255, 0; /* RGB */
}
```

Custom Colors In Palette
Custom Colors In Palette

## Presentation Mode
In presentation mode, you can navigate through the nodes using the arrow keys or the PageUp/PageDown keys (Compatible with most presentation remotes). The different slides/nodes are connected using arrows. If you want to have multiple arrows pointing from the same node, you can number them in the order you want to navigate through them. While in presentation mode, the canvas is in readonly mode (So [better readonly](#better-readonly) effects the presentation mode as well!). You can exit the presentation mode using the `ESC` key or the corresponding command. If you want to continue the presentation from the last slide you were on, you can use the `Advanced Canvas: Continue presentation` command.

Presentation mode example

Canvas File
Presentation canvas file

### More Complex Example
Complex presentation mode example

Canvas File
Complex presentation canvas file

### Usage
- Create the first slide
- Create the first slide of the presentation using the updated popup menu
- OR create a node and mark it as the first slide using the updated card menu
- Add more slides
- Link the slides using arrows
- If you want to loop back to a previous slide, you can number the arrows in the order you want to navigate through them
- TIP: Create slides with consistent dimensions by using the updated card menu
- Control the presentation
- Start the presentation using the command palette (`Advanced Canvas: Start presentation`)
- Change slides using the arrow keys
- Exit the presentation using the `ESC` key

## Portals
Embed other canvases inside your canvas and create edges (arrows) to the embedded canvas.

Portal example

### Usage
- Embed a canvas file and click on the door icon of the popup menu to open a portal

## Collapsible Groups
Collapse and expand groups to organize your canvas.

Collapsible Groups Example
Collapsible Groups Example

## Auto Node Resizing
Resize nodes automatically when the text content changes. Toggle this feature on a per-node basis using the updated popup menu.

Auto Node Resizing Example
Auto Node Resizing Example

## Focus Mode
Focus on a single node and blur all other nodes.

Focus Mode Example
Focus Mode

## Better Readonly
- Disable node popup menus
- Lock the canvas' position
- Lock the canvas' zoom
- BUT to retain some interactivity, it allows zooming to a bounding box (e.g. zoom to selection, zoom to fit all)

### Usage
- Use the updated control menu to toggle the new features (Only shown if the canvas is in readonly mode)

## Encapsulate Selection
Move the current selection to a new canvas and create a link 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`)

## Flip Edge
Flip the direction of an edge with one click.

Flip Edge Example
Flip Edge Example

## Canvas Events
All custom events are prefixed with `advanced-canvas:` and can be listened to using `app.workspace.on` (Just like the default events).


All Events

- `advanced-canvas:canvas-changed`
- Fired when a new canvas gets loaded
- Payload: `Canvas`
- `advanced-canvas:viewport-changed:before` and `advanced-canvas:viewport-changed:after`
- Fired before and after the viewport gets changed
- Payload: `Canvas`
- `advanced-canvas:node-moved`
- Fired when a node gets moved
- Payload: `Canvas`, `Node`, `keyboard: boolean`
- `advanced-canvas:node-resized`
- Fired when a node gets resized
- Payload: `Canvas`, `Node`
- `advanced-canvas:double-click`
- Fired when the canvas gets double-clicked
- Payload: `Canvas`, `MouseEvent`, `preventDefault: { value: Boolean }`
- `advanced-canvas:dragging-state-changed`
- Fired when the dragging state of the canvas changes
- Payload: `Canvas`, `boolean`
- `advanced-canvas:node-created`
- Fired when a new node gets created
- Payload: `Canvas`, `Node`
- `advanced-canvas:edge-created`
- Fired when a new edge gets created
- Payload: `Canvas`, `Edge`
- `advanced-canvas:node-added`
- Fired when a new node gets added
- Payload: `Canvas`, `Node`
- `advanced-canvas:edge-added`
- Fired when a new edge gets added
- Payload: `Canvas`, `Edge`
- Payload: `Canvas`, `Edge`
- `advanced-canvas:node-changed`
- Fired when any node gets changed
- Payload: `Canvas`, `Node`
- `advanced-canvas:edge-changed`
- Fired when any edge gets changed
- Payload: `Canvas`, `Edge`
- `advanced-canvas:node-text-content-changed`
- Fired when the text content of a node gets changed (While typing)
- Payload: `Canvas`, `Node`, `ViewUpdate (From CodeMirror)`
- `advanced-canvas:node-removed`
- Fired when a node gets removed
- Payload: `Canvas`, `Node`
- `advanced-canvas:edge-removed`
- Fired when an edge gets removed
- `advanced-canvas:copy`
- Fired when the selection gets copied
- Payload: `Canvas`, `SelectionData (Reference!)`
- `advanced-canvas:node-breakpoint-changed`
- Fired when the breakpoint of a node changes
- Payload: `Canvas`, `Node`, `breakpoint: { value: boolean }`
- `advanced-canvas:node-editing-state-changed`
- Fired when the editing state of a node changes
- Payload: `Canvas`, `Node`, `boolean (isEditing)`
- `advanced-canvas:node-bbox-requested`
- Fired when the bounding box of a node gets requested (e.g. for the edge path or when dragging a group)
- Payload: `Canvas`, `Node`, `BBox (Reference!)`
- `advanced-canvas:edge-center-requested`
- Fired when the center of an edge gets requested (e.g. for the edge label position)
- Payload: `Canvas`, `Edge`, `Position (Reference!)`
- `advanced-canvas:containing-nodes-requested`
- Fired when the nodes inside a bounding box get requested
- Payload: `Canvas`, `BBox`, `Node[] (Reference!)`
- `advanced-canvas:selection-changed`
- Fired when the selection of the canvas changes
- Payload: `Canvas`, `oldSelection: Set`, `updateSelection: (() => void) => void`
- `advanced-canvas:zoom-to-bbox:before` and `advanced-canvas:zoom-to-bbox:after`
- Fired before and after the canvas gets zoomed to a bounding box (e.g. zoom to selection, zoom to fit all)
- Payload: `Canvas`, `BBox`
- `advanced-canvas:popup-menu-created`
- Fired when the a node popup menu gets created (Not firing multiple times if it gets moved between nodes of the same type)
- Payload: `Canvas`
- `advanced-canvas:node-interaction`
- Fired when a node gets hovered over
- Payload: `Canvas`, `Node`
- `advanced-canvas:undo`
- Fired when undo gets called
- Payload: `Canvas`
- `advanced-canvas:redo`
- Fired when redo gets called
- Payload: `Canvas`
- `advanced-canvas:readonly-changed`
- Fired when the readonly state of the canvas changes
- Payload: `Canvas`, `boolean`
- `advanced-canvas:data-requested`
- Fired when the canvas data gets requested
- Payload: `Canvas`, `CanvasData (Reference!)`
- `advanced-canvas:load-data`
- Fired when the canvas data gets set
- Payload: `Canvas`, `CanvasData (Reference!)`, `setData: (CanvasData) => void`
- `advanced-canvas:canvas-saved:before` and `advanced-canvas:canvas-saved:after`
- Fired before and after the canvas gets saved
- Payload: `Canvas`

## Settings
Every feature can be enabled/disabled in the settings. All features were made to be as customizable as possible.

## Contributing
All code contributions are welcome! (PRs that only update the documentation won't get merged. Please open an issue instead.)
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!

## Star History
![Star History Chart](https://api.star-history.com/svg?repos=Developer-Mike/obsidian-advanced-canvas&type=Date)