Editor: Syntax Highlighting in Code Blocks

Since the editor window uses CodeMirror, it seems like we should be able to add syntax highlighting in code blocks relatively easily (all things considered).

Is that on the roadmap? It is very important to me to be able to use syntax highlighting for different languages in my notes.

Thanks!

56 Likes

I support this feature request. It is quite cumbersome to write code blocks without syntax highlighting. This kind of rendering is great:

Capture d’écran 2020-06-08 à 13.27.18

8 Likes

At the moment syntax highlighting is only supported in the preview.

Code Mirror is syntax highlighting the markdown in the editor. I’m not sure how difficult it would be to configure multiple language syntax highlighting in the editor…

2 Likes

I really want this as well.

3 Likes

+1 to this request. Without syntax highlighting it is difficult to use obsidian for writing code of any kind. Instead you have to work elsewhere and then paste into Obsidian when done

2 Likes

+1 to this too. I use Obsidian in editor mode 90% of the time, therefore having syntax highlighting for code blocks would be very handy.

5 Likes

+1 I just started using this instead of VS Code for notes. Love it so far but was surprised when code highlighting wasn’t active.

2 Likes

+1 Hopefully this will be possible in the near feature, for programmers like myself, the syntax highlight for the editor view part is essential.

5 Likes

This is one of the the reason why Roam is still top on my list, instead of obsidian

I think this plugin is the perfect solution https://github.com/deathau/cm-editor-syntax-highlight-obsidian

6 Likes

I think this shouldn’t be a third-party plugin. It should be a built-in feature. Any reasons it’s not added?

1 Like

+1. Would be a great addition to Obsidian

1 Like

Thanks for the plugin. Is there a way to make it work for R code syntax highlighting support?

Would love to see syntax highlighting available by default :pray:

1 Like

+1 for this

+1 for this :clap:

+1 Please add this function!

+1 :+1:

I’m also using this! It’s a bit disconcerting though that the preview syntax highlighting does not match the editor’s. As for me, I prefer the plugin’s highlighting to the native one. Are you able to sync them?

No I don’t think that is possible. Preview and edit mode uses completely different libraries for the highlighting. Source