outsiders17711995 downloadsDisplay files with custom extensions as syntax-highlighted code blocks in reading view with configurable extension-to-language mappings.
An Obsidian plugin that displays files with custom extensions as syntax-highlighted code blocks in reading view, with configurable extension-to-language mappings.
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:
You can also install the plugin directly from its Community Plugins entry: Custom Syntax Highlights on Obsidian.
main.js, manifest.json, and styles.css to your vault's .obsidian/plugins/custom-syntax-highlights/ directoryConfigure extension-to-language mappings in Settings → Community plugins → Custom File Extensions:
| 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) |
.md): Not supported - handled natively by Obsidianmd or markdown to disable highlighting and enable normal editingnpm 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 vault
npm run release # automated patch release
npm run release:minor # minor version release
npm run release:major # major version release
Requirements: Node.js 16+, Git repository with GitHub origin
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