• Stars
    star
    351
  • Rank 120,906 (Top 3 %)
  • Language
    JavaScript
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A plugin for [Obsidian](https://obsidian.md) which allows syntax highlighting for code blocks in the editor.

Editor Syntax Highlight Obsidian Plugin

A plugin for Obsidian which allows syntax highlighting for code blocks in the editor.

Screenshot

Imports code from CodeMirror

Compatibility

Custom plugins are only available for Obsidian v0.9.7+.

The current API of this repo targets Obsidian v0.9.7.

Notes

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.

Installation

From within Obsidian

From Obsidian v0.9.8, you can activate this plugin within Obsidian by doing the following:

  • Open Settings > Third-party plugin
  • Make sure Safe mode is off
  • Click Browse community plugins
  • Search for "Syntax Highlight"
  • Click Install
  • Once installed, close the community plugins window and activate the newly installed plugin

Updates

You can follow the same procedure to update the plugin

From GitHub

  • Download the Latest release
  • Extract the cm-editor-syntax-highlight-obsidian folder from the zip to your vault's plugins folder: <vault>/.obsidian/plugins/
    Note: On some machines the .obsidian folder may be hidden. On MacOS you should be able to press Command+Shift+Dot to show the folder in Finder.
  • Reload Obsidian
  • If prompted about Safe Mode, you can disable safe mode and enable the plugin. Otherwise head to Settings, third-party plugins, make sure safe mode is off and enable the plugin from there.

Development

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:

  • Clone this repo.
  • npm i or yarn to install dependencies
  • npm run build to compile.
  • Copy manifest.json, main.js and styles.css to a subfolder of your plugins folder (e.g, <vault>/.obsidian/plugins/cm-editor-syntax-highlight-obsidian/)
  • Reload obsidian to see changes

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.

Pricing

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

Version History

0.1.3

  • Fixed elixir mode (sorry this took me so long to release, it was fixed AAAGES ago...)
  • Added javascript syntax highlighting for dataviewjs blocks (thanks @dbarenholz)
  • Added YAML syntax highlighting for dataview and tracker blocks (thanks @KjellConnelly)

0.1.2

  • Added elixir mode (thanks to James Dalton)

0.1.1

  • Apply codemirror theme to latex math also

0.1.0

  • Adjusted the dark codemirror theme to also apply to frontmatter
  • Reload the editor modes on load, so syntax highlighting is shown on enable
  • Delete editor modes on unload, so syntax highlighting is hidden on disable

v0.0.1

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.

More Repositories

1

sliding-panes-obsidian

Andy Matuschak Mode as a plugin
TypeScript
654
star
2

obsidian-snippets

CSS
587
star
3

Notation-for-Obsidian

A theme for Obsidian, inspired by and borrowing elements from Notion
CSS
162
star
4

cm-typewriter-scroll-obsidian

Typewriter Scroll Obsidian Plugin
TypeScript
109
star
5

80s-Neon-for-Obsidian.md

A retro-future 80s inspired theme for Obsidian.md
CSS
95
star
6

csv-obsidian

Edit CSV Files in Obsidian
TypeScript
94
star
7

txt-as-md-obsidian

Edit txt files in Obsidian.md as if they were markdown
JavaScript
76
star
8

cm-show-whitespace-obsidian

A plugin for [Obsidian](https://obsidian.md) which shows whitespace in the editor.
TypeScript
43
star
9

maximise-active-pane-obsidian

A plugin for [Obsidian](https://obsidian.md) which simply fills the workspace with the active pane.
TypeScript
33
star
10

command-uri-obsidian

Trigger any command palette command via an obsidian:// uri
TypeScript
21
star
11

snippet-commands-obsidian

Registers custom css snippets as commands (which you can bind hotkeys to)
TypeScript
15
star
12

Base2Tone-For-Obsidian.md

A theme for Obsidian based on http://base2t.one/ and http://simurai.com/duotone-dark-sky-syntax/
CSS
13
star
13

ini-obsidian

Edit ini files in Obsidian
TypeScript
10
star
14

cooklang-js

CookLang-JS is a TypeScript library for parsing CookLang.
TypeScript
10
star
15

obsidian-christmas-theme

Inspired by the Dynalist Christmas theme
CSS
5
star
16

markdown-transclude

Transcludes other markdown files into one
JavaScript
4
star
17

psuedo-wysiwyg-obsidian-theme

A theme for Obsidian, which attempts to build out a pseudo-WYSIWYG-like experience (as much as custom CSS will allow).
SCSS
3
star
18

LDToypad.NET

A .NET Core C# library for communicating with the LEGO Dimensions Toypad
C#
3
star
19

base-plugin-obsidian

TypeScript
3
star
20

workflow-experiments

Playing around with github actions, especially for releasing obsidian plugins
TypeScript
2
star
21

editorjs-playground

JavaScript
2
star
22

Obsidian-Roam-theme

An Obsidian.md theme based on Roam Research
CSS
2
star
23

test-activitypub-db

This is just a test of an ActivityPub database, with data stored in yaml-frontmatter md files, persisted in git
HTML
2
star
24

11ndieWeb

Liquid
1
star
25

fastify-activitypub

JavaScript
1
star
26

workflow

1
star
27

death.id.au-micropub

JavaScript
1
star
28

aerion-hubot

CoffeeScript
1
star
29

slack-dark-redux

Yet another dark theme for Slack
CSS
1
star
30

link-in-bio-template

JavaScript
1
star
31

cube-tube

Messing around with a tetris-like falling block game (on a train?) in DragonRuby GTK
Ruby
1
star