Cython syntax highlighting not applied in Reading View

Steps to reproduce

Type in the following code block into the note:

def merge(j, k, l):
		int j
		int N = 2000
		float dx, s = 0.0

Expected result

The syntax should be properly highlighted in Reading View AND Editing View.

Actual result

The syntax is highlighted only in Editing View and not Reading View.


	Obsidian version: v1.5.12
	Installer version: v1.4.16
	Operating system: Windows 10 Pro 10.0.19045
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: light
	Community theme: none
	Snippets enabled: 1
	Restricted mode: off
	Plugins installed: 0
	Plugins enabled: 0

Additional information

Editing View

Reading View

1 Like

Syntax highlighting is different between the editor (Source mode and Live Preview) and Reading view.

Obsidian uses Prism for syntax highlighting. For more information, refer to Supported languages.

Source mode and Live Preview do not support PrismJS, and may render syntax highlighting differently.

I see.

But what surprises us is that sometimes the Source mode and Live Preview provides better syntax highlighting than the Reading view.

Is there a plan to take the best of each and merge them for consistency?
I am pretty sure that we all expect consistent syntax highlighting across the views.

Just for the history sake, I found a similar post and attaching it down below:

1 Like

Yeah, I was surprised cython wasn’t in the PrismJS supported languages list at all (I didn’t see it). Does it go by another name or is there something similar you could use?

I’m not part of the team, so can’t speak on the development or decisions made.

I have re-checked the support list and no… it is just not there.
The most similar one is of course Python, but it lacks some of the crucial keyword highlighting such as cdef.

I just hope that the dev team becomes aware of this on-going issues on inconsistent syntax highlighting and come up with fixes in the near future. :wink:

Why doesn’t Live Preview support prism.js?