Highlight Bash/shell code in Markdown files

Ionică Bizău picture Ionică Bizău · Nov 30, 2013 · Viewed 312.1k times · Source

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?

Answer

hek2mgl picture hek2mgl · Nov 30, 2013

It depends on the Markdown rendering engine and the Markdown flavour. There is no standard for this. If you mean GitHub flavoured Markdown for example, shell should work fine. Aliases are sh, bash or zsh. You can find the list of available syntax lexers here.