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

File to Code Block

meduseromedusero2 downloads

Insert text files (such as dotfiles or scripts) from your computer into the current note as fenced code blocks, with the language detected from the file name.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates2

An Obsidian plugin that inserts a text file from your computer into the current note as a fenced code block, with the language detected from the file name.

It is handy for keeping copies of configuration files (dotfiles such as .zshrc or .gitconfig), scripts and other small text files in your notes. The block is inserted at the cursor position of the active note.

Desktop only: the plugin reads files with Node.js, which is not available in Obsidian Mobile.

Installation

Manual installation

  1. Download main.js, manifest.json and styles.css from the latest release.
  2. In your vault, create the folder .obsidian/plugins/file-to-code-block/ and copy the three files into it. On some systems .obsidian is hidden; enable hidden files in your file manager to see it.
  3. Reload Obsidian, then enable File to Code Block under Settings → Community plugins → Installed plugins.

Configuration

In Settings → File to Code Block:

Setting Description
Add entry Adds a file name → language pair (e.g. .myrc → bash). Both fields are required and the file name must be new.
Custom languages The list of entries you have added. They take priority over the built-in list.

If you enter a language that Obsidian's code highlighter does not know, the plugin shows a notice. This is only a hint: the entry is still saved, and highlighting in reading view may simply be missing.

Usage

Run File to Code Block: Insert file as code block from the command palette, then type the absolute path of the file. A leading ~ is expanded to your home directory.

  • The language is taken from the file name, using a built-in list of well-known files and extensions (for example, .zshrc becomes bash and .gitconfig becomes ini) and your custom languages.
  • If no language is detected, the plugin asks you for one.
  • Files larger than 2 MB or with more than 1000 lines are rejected, so a wrong path (a binary, a log) does not flood your note.
  • Error messages never show system paths, and the plugin only reads files; it never writes outside your vault.

License

MIT

HealthExcellent
ReviewSatisfactory
About
Insert a local text file into the active note as a fenced code block with language auto-detected from the filename or your custom mappings. Keep configs, scripts and dotfiles inline; prompt for unknown languages, reject large/binary files, and run on desktop only (reads files only).
FilesCodeImport
Details
Current version
1.0.1
Last updated
21 hours ago
Created
23 hours ago
Updates
2 releases
Downloads
2
Compatible with
Obsidian 1.13.0+
Platforms
Desktop only
License
MIT
Report bugRequest featureReport plugin
Author
meduseromeduseromedusero
GitHubmedusero
  1. Community
  2. Plugins
  3. Files
  4. File to Code Block

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.

Code Space

Professional code file management with visual dashboard, syntax highlighting editor, Markdown embedding, external folder mounts, and terminal integration.

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.

Templater

Create and use dynamic templates.

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)

Mermaid Tools

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

Local REST API with MCP

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