Oleksandr15 downloadsOpen code files at specific lines using relative paths directly from Canvas cards and markdown links.
English | Русский
Link Canvas cards and notes straight to a line of source code. Write [Player](../src/Player.cs#L105) and a click opens the file at that line in VS Code, Cursor, Rider or Obsidian. Built for documenting a game or any code base that lives next to your vault.
Works on desktop and on mobile (iOS / Android).
.canvas / note first, then from the vault root. Links stay portable across Windows, macOS and Linux.:42, :42:15, #L42, #L42C10.path:line), computes the relative path and checks the file exists.| Format | Example |
|---|---|
| Line | [script.cs:42](./scripts/script.cs:42) |
| Line and column | [script.cs](./scripts/script.cs:42:15) |
| GitHub style | [Player.cs](../src/Player.cs#L105) |
| Explicit scheme | [script.cs](code:./src/script.cs:50) |
| Wikilink | [[./scripts/script.cs:42]] |
| Obsidian URI | obsidian://canvas-code-link?file=./script.cs&line=42 |
A link is treated as code when it has a recognized extension (configurable) or an explicit code: / file:// / vscode://file/ prefix.
Until the plugin is available in the community list, install it manually:
main.js, manifest.json and styles.css from the latest release.<vault>/.obsidian/plugins/canvas-code-links/.On mobile, sync the vault (including the .obsidian folder) with Obsidian Sync, iCloud, Syncthing or similar, then enable the plugin on the phone.
A phone cannot launch desktop editors, so choose a mode in Settings → Canvas Code Links → Mobile:
| Mode | What it does |
|---|---|
| Built-in code viewer (default) | Shows the file with the target line highlighted. Works offline. |
| Open web URL | Opens a repository URL built from a template, e.g. https://github.com/OWNER/REPO/blob/main/{relpath}#L{line} |
The code must be inside the vault (for example a game repo synced with Obsidian Git). Links in the editor are followed with Ctrl/Cmd+click, so on a phone use reading view or rendered Canvas cards.
{path}, {uripath}, {line}, {col}).vscode://, cursor://, jetbrains://, or your custom URI) through the operating system. With the Custom CLI Command editor it runs the shell command you typed in the settings, with the file path, line and column substituted in. Only set commands you trust.npm install
npm test # tests run against the real src/*.ts (obsidian is mocked)
npm run build # type-check and produce main.js
npm run dev # watch mode
To release: bump version in manifest.json and package.json, add the version to versions.json, then push a tag that equals the version (for example 1.1.1). The Release workflow builds and publishes main.js, manifest.json and styles.css.