Code Highlighting in Code Block Doesn't Work in Live Preview for Hoon

The Hoon programming language, which has correct syntax highlighting in Obsidian, does not seem to have syntax highlighting when using live preview.

Steps to reproduce

type the following code with live preview

(add 1 1)

Expected result

The syntax gets highlighted (“add” shows up in yellow)

Actual result

The syntax is not highlighted in live preview mode, I have to switch to reading mode.

Not a bug. The upstream editor (codemirror6) doesn’t support it.

It really would be nice to be able to do some light code modifications in Obsidian with the benefit of syntax highlighting. I went to the GitHub page for Codemirror, and it appears that in terms of pull requests for specific language syntax highlighting support, it is not the right place. I may be wrong, but I just didn’t see any similar requests in the recently closed items.

I am very unfamiliar with Codemirror, and wonder where one might make a request for something like this. After looking around on their official site, I’ll return to edit this if I have found anything helpful. Or maybe someone else might possibly clarify whether making a request like this would even be feasible.

Thanks in advance.

1 Like

What does the reader mode use to render the code, and is that available anywhere to use as the basis for a code mirror package?

1 Like

@alexv Reader Mode uses Prismjs.

Good question about potentially being able to use the work done to implement a language in Prismjs to simplify the process of creating a new language package for Codemirror. I had thought doing this was far above my head. That being said, I remember when I requested MAXScript to be a supported language for Prismjs, one of the contributors posted the implementation very quickly, like within a day. Somehow they must have leveraged the documentation in some super streamlined way. It was quite impressive.

I’d be interested to hear what others say or whether there might be contributors for Codemirror to reach out to who might potentially ease some of the difficulties with the learning curve here. Thanks.