Allow setting syntax highlighting language for inline code

We can already set the language for fenced code blocks, e.g. ```bash to start a properly highlighted shellscript block

In pandoc-style markdown (but not most others, I think), you can also set a highlighting language for inline code, e.g. `print('hello world!')`{.python} for a colorful inline python snippet. This would be a great feature in Obsidian for making beautiful computing notes

30 Likes

Would be great :star_struck:…because I am having A LOT of code snippets and fences in my notes! Thanks for this proposal!

2 Likes

I would also find this very useful. I often write myself code blocks with full examples and then I write a prose section or bullet points with inline code surrounded by English so I can get a theoretical idea of what the code is supposed to do.

Here is an example. (This note is network engineering commands, but I do the same thing for proper code.)

As you can see, there is no consistent highlighting across inline and code blocks.

I would love the ability to specify how the inline code snippets should be highlighted on a per-note basis using a YAML header. This would allow me to make high-quality evergreen notes with consistent code formatting.

Agreed–would be great to have language-specific code highlighting!

Is there a way of integrating a tool like Vale for prose linting directly or via plugin?

This would be great

Definitely need that too! +1

I agree, very useful idea.

+1 would be a great feature

+1, following

+1 would really boost my note readability

+1 would be great

Also +1!

I’ve implemented this functionality in my plugin: GitHub - mayurankv/Obsidian-Code-Styler: A plugin for Obsidian.md for styling codeblocks and inline code.

The syntax used is {python} def func():. This was easier to get going at first than the pandoc syntax (def func():.{python}). However, if there is demand to change to this syntax (or another syntax), then let me know and I can try and implement this!

2 Likes

Godsend!

1 Like

Thank you very much for the work! This should be a core functionality…