DEV Community


How to highlight bash/shell code in markdown

okolilemuel profile image Lemuel Okoli ・1 min read

If you are looking to highlight a shell session command sequence as it looks to the user (with prompts, not just as contents of a hypothetical script file), then the right identifier to use at the moment is console:

foo@bar:~$ whoami

The highlighting includes the prompt, whereas bash, sh, zsh, and shell do not consider the start of the line to be the prompt and don't colour it properly.


Discussion (0)

Editor guide