Bash or shell command syntax highlighting

Hello, I am aware that in a code block, I can specify the language to highlight after the first three backticks.

What is the best practice to do this with simple bash commands and scripts? I am brand new to Linux and I’m copying lots of commands into my notes to learn them.

I have tried bash, shell, and console, and they all produce the same highlights.

What confuses me is that the highlighting colors seem random: numbers are purple, “sudo” is yellow but the rest of the command will be in gray, other words like “wait” and “command” will also be yellow, the word “for” is turquoise, etc.

Is there a neater way to highlight simple console commands? Or am I misunderstanding why the color choices are this way?

Thanks!

The colors come from the syntax highlighting library. You can find more info on that here: Make Obsidian code blocks compatible with prismjs spec and other apps

Okay thank you! So this is using the prismjs library for syntax highlighting?

I guess I’m wondering what the rationale is for the color choices for simple bash / console code blocks. It seems random to me. I’m not finding much info online about the color choices. But perhaps it isn’t really geared towards that if it’s rather intended for real programming languages.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.