An Obsidian plugin that displays files with custom extensions as syntax-highlighted code blocks in reading view, with configurable extension-to-language mappings.
- Custom Extension Mapping: Configure any file extension to display with specific syntax highlighting
- Auto-Switch to Reading View: Automatically switch configured file extensions to reading view when opened
- Flexible Language Support: Map extensions to any supported syntax highlighting language
- Clean Display: Files are rendered as single, properly formatted code blocks
On the left is Source Mode, and on the right is Reading Mode. Click either image to enlarge.
You can install the plugin directly from Obsidian's Community Plugins browser:
- Open Obsidian and go to Settings > Community plugins
- Click on Browse and search for "Custom Syntax Highlights"
- Click Install and then Enable the plugin
You can also install the plugin directly from its Community Plugins entry: Custom Syntax Highlights on Obsidian.
- Download the latest release from GitHub Releases
- Extract
main.js,manifest.json, andstyles.cssto your vault's.obsidian/plugins/custom-syntax-highlights/directory - Reload Obsidian and enable the plugin in Settings → Community plugins
Configure extension-to-language mappings in Settings → Community plugins → Custom File Extensions:
- Extension: The file extension (without the dot)
- Language: The syntax highlighting language to use (leave empty to use the extension name)
| Extension | Language | Result |
|---|---|---|
tex |
(empty) | LaTeX files with TeX syntax highlighting |
json |
(empty) | JSON files with JSON syntax highlighting |
bib |
ini |
Bibliography files with INI-style highlighting |
py |
python |
Python files with Python syntax highlighting |
txt |
md |
Text files with normal editing (no highlighting) |
- Markdown files (
.md): Not supported - handled natively by Obsidian - Normal editing: Set language to
mdormarkdownto disable highlighting and enable normal editing - Auto-switch: Toggle whether files automatically open in reading view
- Configure extension mappings in plugin settings
- Open any file with a configured extension
- File automatically switches to reading view with syntax highlighting
npm install # install dependencies
npm run dev # development build with watch mode
npm run build # production build
npm run test # update the plugin in the test vaultnpm run release # automated patch release
npm run release:minor # minor version release
npm run release:major # major version releaseRequirements: Node.js 16+, Git repository with GitHub origin
- Release Process - Complete guide for maintainers
- Changelog - Version history and release notes
Built upon the foundation of MeepTech/obsidian-custom-file-extensions-plugin for file extension registration. This plugin now implements a complete 2-in-1 solution with both file extension registration and syntax highlighting.
MIT License