Bash – Highlight Bash/shell code in Markdown files

bashgithub-flavored-markdownmarkdownshell

How can I highlight the Bash/shell commands in Markdown files?


For example, to highlight js, I write:

```js
function () { return "This code is highlighted as Javascript!"}
```

To highlight HTML code I use ```html.

How can we highlight Bash/shell commands?

Best Answer

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:

```console
foo@bar:~$ whoami
foo
```

GitHub Markdown preview tab screenshot