You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Changelog.txt
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
- 1.4.1 (2026.03.11)
2
+
New:
3
+
- Added option to use PrismJS for syntax highlighting in editor mode. This means more languages get syntax highlight and same syntax highlight between editor and reading mode (#82,#134,#140)
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ The plugin lets you customize the code blocks in the following way:
22
22
- Transform code comments into styled annotations.
23
23
- Apply syntax highlighting to inline code.
24
24
- Hide fence lines in editor mode for a cleaner look.
25
+
-**NEW:** Added option to use PrismJS for syntax highlighting in editor mode => Same syntax highlight in editor and reading mode and more langauges get syntax highlighted
25
26
-**NEW:** Search option in the settings page to find faster a specific setting
26
27
-**NEW:** Wrap/Unwrap button in editor mode
27
28
-**NEW:** Execute Code Plugin compatibility
@@ -39,6 +40,7 @@ For a more detailed list of changes, check the [Changelog](./Changelog.txt).
@@ -118,6 +120,27 @@ All parameters can be defined using `:` or `=`.
118
120
119
121
</details>
120
122
123
+
## PrismJS Syntax Highlighting
124
+
125
+
This is an **experimental** setting, but it is worth talking about this.
126
+
127
+
Small background information:
128
+
The syntax highlighting wasn't the same in editing and reading mode, because Obsidian uses two different engines. The one used in editor mode is `CodeMirror 6`, and the other for reading mode is `PrismJS`. The problem with this is, that `CodeMirror` supports less languages then `PrismJS`, and even if it supports the same language it will probably still differ, because it works different.
129
+
130
+
So what does this setting do? It forces the editor to use `PrismJS` in editor mode. This results, that when this setting is enabled, the syntax highlighting is the **same** in editing and reading modes!
131
+
But that's not all! This setting also has a positive side effect. `CodeMirror` does support a lot of languages, but nearly not as many as `PrismJS`. When this setting is enabled, that also means that languages which `CodeMirror` does not support (e.g. `graphql` or `makefile` or `hlsl`) also get syntax highlighting, because `PrismJS` does support it.
132
+
133
+
Even though this setting is not as thourughly tested as others, I wanted to release it easlier. Should you encounter some errors or bugs, just open an issue.
134
+
135
+
Example code block in editor mode with the setting disabled:
136
+
137
+

138
+
139
+
Same code block with setting enabled (matches reading mode):
140
+
141
+

142
+
143
+
121
144
## Themes
122
145
123
146
The plugin comes with multiple themes (Obsidian, Solarized, Dracula, Gruvbox, Nord, Tokyo Night). The default theme is Obsidian.
.setName('Use PrismJS syntax highlighting in editor mode')
41
+
.setDesc('If enabled, editor mode will use PrismJS for syntax highlighting instead of CodeMirror\'s built-in highlighting. This makes editor mode syntax highlighting match reading mode syntax highlighting.')
Copy file name to clipboardExpand all lines: src/SettingsTab/Behavior.ts
-16Lines changed: 0 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -57,22 +57,6 @@ export class BehaviorSettings {
57
57
})
58
58
);
59
59
60
-
constprismSetting=newSetting(behaviorDiv)
61
-
.setName('Use PrismJS syntax highlighting in editor mode')
62
-
.setDesc('If enabled, editor mode will use PrismJS for syntax highlighting instead of CodeMirror\'s built-in highlighting. This makes editor mode syntax highlighting match reading mode syntax highlighting.')
0 commit comments