A plugin for [Obsidian](https://obsidian.md) which allows syntax highlighting for code blocks in the editor.
A plugin for Obsidian which allows syntax highlighting for code blocks in the editor.
Imports code from CodeMirror
Custom plugins are only available for Obsidian v0.9.7+.
The current API of this repo targets Obsidian v0.9.7.
This is all very expermental at the moment, so parts might not work, etc.
This imports a bunch of syntax highlighting modes from CodeMirror, as well as the yonce theme for dark mode.
From Obsidian v0.9.8, you can activate this plugin within Obsidian by doing the following:
You can follow the same procedure to update the plugin
cm-editor-syntax-highlight-obsidian
folder from the zip to your vault’s plugins folder: <vault>/.obsidian/plugins/
.obsidian
folder may be hidden. On MacOS you should be able to press Command+Shift+Dot
to show the folder in Finder.This project uses Typescript to provide type checking and documentation.
The repo depends on the latest plugin API in Typescript Definition format, which contains TSDoc comments describing what it does.
Note: The Obsidian API is still in early alpha and is subject to change at any time!
If you want to contribute to development and/or just customize it with your own
tweaks, you can do the following:
npm i
or yarn
to install dependenciesnpm run build
to compile.manifest.json
, main.js
and styles.css
to a subfolder of your plugins<vault>/.obsidian/plugins/cm-editor-syntax-highlight-obsidian/
)Alternately, you can clone the repo directly into your plugins folder and once
dependencies are installed use npm run dev
to start compilation in watch mode.
You may have to reload obsidian (ctrl+R
) to see changes.
Huh? This is an open-source plugin I made for fun. It’s completely free.
However, if you absolutely have to send me money because you like it that
much, feel free to throw some coins in my hat via
PayPal or sponsor me via
GitHub Sponsors
dataviewjs
blocks (thanks @dbarenholz)dataview
and tracker
blocks (thanks @KjellConnelly)Initial Release.
Copy-pasted and imported editor modes from CodeMirror 5.58.2. Got compiler errors importing markdown
and gfm
, so those aren’t available for now.