I’m wondering if there’s any way to add custom syntax highlighting in Obsidian for programming languages that are not natively supported by Prism.js? I’m open to solutions such as modifying Prism.js, using plugins, writing a custom plugin, or even integrating a different syntax highlighter like Highlight.js. If anyone has experience with adding new languages or extending Prism.js within Obsidian, I’d love to hear your approach and any potential limitations.
I think that, generally speaking and from what I’ve seen, what people do when wanting to highlight a language Prism doesn’t support (yet ?) is to either use an existing plugin providing said highlight or create their own …
E.g.: That’s what the 3 first plugins you’ll find here seems to be doing…
Another option, you could take a look at the community plugin Shiki Highlighter… Maybe it already supports the language you’re looking for/would like to highlight
What I’m really looking for is something highly customizable. I may invent a new language at some point, which won’t ever be supported by any existing highlighter, or I might want to tweak the syntax styles for languages that already exist. That’s why I’m hoping for a solution that allows me to do everything myself, or at least find a plugin that offers that level of flexibility. Do you know of any plugins or methods that would let me fully customize or create my own syntax highlighting?
Use shiki plugin as mentioned. Then create your own My-Awesome-Language.tmLanguage.json. You’ll need to search the web how to. Finally, open shiki settings. Detailed steps here.