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 Import

yhao3yhao3126 downloads

Import code files with @import syntax. Compatible with Markdown Preview Enhanced.

Add to Obsidian
Code Import screenshot
Code Import screenshot
  • Overview
  • Scorecard
  • Updates1

Import external code files in your Obsidian notes using @import syntax (compatible with Markdown Preview Enhanced).

🔗 Website · Community plugin page

Screenshots

Desktop

Full file import:

Full Import

Partial import (specific lines):

Partial Import

Mobile (iOS)

Full import Partial import
Mobile Full Mobile Partial

Features

  • Import code files directly in Reading View
  • Support line range selection (line_begin, line_end)
  • Automatic syntax highlighting based on file extension
  • Works with relative paths (including ../)

Syntax

@import "path/to/file.go"
@import "path/to/file.go" {line_begin=4 line_end=14}
@import "examples/main.py" {line_begin=10}
@import "config.yaml" {line_end=-4}

Parameters

Parameter Description (0-based) Description (1-based)
line_begin Start line, 0-based index Start line, 1-based index
line_end End line, exclusive (supports negative) End line, inclusive (supports negative)

Line Index Examples

0-based mode (default, MPE-compatible):

  • {line_begin=0 line_end=10} → Lines 1-10 (indices 0-9)
  • {line_begin=5} → From line 6 to end
  • {line_end=-2} → From start, excluding last 2 lines

1-based mode:

  • {line_begin=1 line_end=10} → Lines 1-10
  • {line_begin=5} → From line 5 to end
  • {line_end=-2} → From start, excluding last 2 lines

Installation

From Community Plugins

  1. Open Settings → Community plugins
  2. Search for "Code Import"
  3. Install and enable

Or install directly from the community plugin page.

Manual Installation

  1. Download main.js, manifest.json, styles.css from Releases
  2. Create folder: <vault>/.obsidian/plugins/code-import/
  3. Copy the files into the folder
  4. Enable the plugin in Settings → Community plugins

Usage

  1. Place your code files in your vault (or reference them with relative paths)
  2. Add @import directive in your markdown file
  3. Switch to Reading View to see the imported code

Example

In your markdown file:

## User Struct Definition

@import "examples/user.go" {line_begin=10 line_end=25}

Settings

Setting Description Default
Show file name Display filename header above code block On
Wrap code Wrap long lines instead of horizontal scrolling Off
Line number base 0-based (MPE-compatible) or 1-based indexing for line_begin/line_end 0-based

License

MIT

HealthExcellent
ReviewSatisfactory
About
Import external code files into your notes using @import syntax (compatible with Markdown Preview Enhanced). Select specific line ranges, use relative paths (including ../), and display imported code with automatic syntax highlighting in Reading View.
CodeImportFiles
Details
Current version
1.0.0
Last updated
2 months ago
Created
8 months ago
Updates
1 release
Downloads
126
Compatible with
Obsidian 1.0.0+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Sponsor
Ko-fi
Author
yhao3yhao3
github.com/yhao3
GitHubyhao3
  1. Community
  2. Plugins
  3. Code
  4. Code Import

Related plugins

RSS Dashboard

A dashboard for organizing and consuming RSS feeds, YouTube channels, and podcasts with smart tagging, media playback, and seamless content flow.

Telegram Sync

Transfer messages and files from Telegram to Obsidian.

Notebook Navigator

A better file browser and calendar inspired by Apple Notes, Bear, Evernote and Day One.

Importer

Convert your data to Markdown files you can use in Obsidian. Works with Apple Notes, OneNote, Evernote, Notion, Google Keep, and many other formats.

Claudian

Embeds Claude Code/Codex and other local Agents as AI collaborators in your vault.

Advanced URI

Control everything with URI.

Thino

Quickly capture memos and display them in the sidebar with a heatmap. (Closed source)

Local REST API with MCP

Unlock your automation needs by interacting with your notes over a secure REST API.

ChatGPT MD

A seamless integration of ChatGPT, OpenRouter.ai and local LLMs via Ollama into your notes.

QuickAdd

Quickly add new notes or content to your vault.