Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Code Link

observerwobserverw838 downloads

Link to code files in your notes

Add to Obsidian
  • Overview
  • Scorecard
  • Updates5

[ English | 简体中文 ]

Display code in Obsidian, and only the part you're interested in!

main

  • Link to code files as you would link to notes, and you can preview their contents.
  • Even better, through symbol search/tag search/code outline (or whatever you want to call it.), you can link directly to a specific symbol in the code file (such as a class, a function, or a method within a class).

By creating links with symbols, you can reference only the code parts that interest you in your notes and avoid distractions from other content. This is particularly useful when taking code notes (for example, when studying a complex open-source project).

⚠️ATTENTION

  • To be able to link to the code file with internal link, make sure that the Settings - Files and Links - Detect all types of files option are enabled.
  • Embed preview only works in reading view, so if you find that the preview is not displayed, please switch to reading view by pressing Ctrl/Cmd + E.
  • Before you perform a tag search, make sure that Settings - Code Link - Enable tag search option is enabled.

Usage

  1. Create a folder in your obsidian repository for storing imported projects of your code projects, the default path is projects.
  2. Open Command Palette and run Code Link: Import project, select the project folder you want to import (see this section below), then the project will be imported into the folder you created in step 1.
  3. Open editor, link to the code file just like linking to a note, then you can preview the code in the editor.

Code Preview

Supports both hover preview and embed preview of the code file.

Below the embed preview lists the link to the referenced code file, and the tag path to the current symbol (e.g., if you link to a method named methodB in a class named ClassA, the tag path is class ClassA > def methodB). When you click on a symbol in the tag path, the embed preview will temporarily switch the content of the displayed code to the content of that symbol.

Tag Search

Place the cursor behind the code link (e.g. [[main.py]]|, where | is the cursor) will trigger tag search. The code link will be replaced when the specified symbol is selected in the tag search. Entering something from this position will filter the entries in the tag search, e.g. [[main.py]]def will filter all entries in the entry that contain the def keyword. Note that the entry needs to be immediately followed by ]].

⚠️ATTENTION: After installing the plugin, if the tag search fails to trigger, try closing and reopening Obsidian.

This feature is implemented with the help of TreeSitter and .scm files from the zed editor. Current support languages are: C, C++, JavaScript, TypeScript, Rust, Go, Python. If you want more languages to be supported, please consider writing tree-sitter queries for other languages modeled after existing .scm files and open a pull request. I would appreciate that!

Import Project Into Obsidian Vault

Obsidian only allows to link to files within the vault, so you need to import the project into your vault before you can link to it.

To import a project, open command palette and run Code Link: Import project, then select the project folder you want to import. The project will be imported into the projects folder.

Note that "import" means create symbol links (or file shortcuts in Windows) to the original files. Symlink are just reference to the original file, so if you delete the original file, the symlink will be broken.

73%
HealthGood
ReviewCaution
About
Link to code files like notes and preview only the parts you care about, referencing specific classes, functions, or methods. Import projects, search symbols or tags, and use hover or embed previews to display focused code snippets inline.
CodeLinksSearch
Details
Current version
1.0.4
Last updated
2 years ago
Created
2 years ago
Updates
5 releases
Downloads
838
Compatible with
Obsidian 0.15.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
observerwobserverw
github.com/observerw
GitHubobserverw
  1. Community
  2. Plugins
  3. Code
  4. Code Link

Related plugins

Smart Connections

AI link discovery copilot. See related notes as you write. Lookup using semantic (vector) search across your vault. Zero-setup local model for embeddings, no API keys, private.

Better Search Views

Upgrade global search, backlinks and queries with outliner-like context trees.

Templater

Create and use dynamic templates.

Omnisearch

Intelligent search for your notes, PDFs, and OCR for images.

Quick Switcher++

Enhanced Quick Switcher, search open panels, and symbols.

Excalidraw

Visual PKM powerhouse. Create and edit Excalidraw drawings.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

Quiet Outline

Make outline quiet and more powerful, including no-auto-expand, rendering heading as Markdown, and search support.

Link Favicons

See the favicon for a linked website.

PlantUML

Generate PlantUML diagrams.