Replace PrismJS/HyperMD syntax highlighting in favour of a maintained library

Use case or problem

(Unsure what system is actually been used now, seeing references to PrismJS on the forum in the past, but current markup leads me to HyperMD.)

PrismJS has not been maintained for the past 2–3 years. The main two maintainers have moved on to other projects and the development, if there ever was any, of PrismJS v2 is for all intents and purposes dead atfer 2 years of silence on the various issues.

HyperMD has similar issues.

In the mean time, popular programming languages like Python, Rust, and Go have added new language features which are not reflected in the syntax highlighting support for Obsidian because of this. A language like Zig is not even supported. I am sure there are other parts of the syntax highlighting that are also painfully behind in language support and fixes.

Example of the walrus operator (:=) from Python 3.8 (2019!) not being properly highlighted (the resulting HTML/CSS splits the := into two separate characters with semantic meaning underwater):

Proposed solution

Replace PrismJS/HyperMD with a maintained library. The better ones I have seen so far are:

They both also support the HTML 5 spec way of using code blocks with a <pre><code class="language-python"> kind of setup.

Current workaround (optional)


Related feature requests (optional)


1 Like