Syntax highlighting for console snippets
Harald Hoyer May 19, 2020Finally, I moved my blog from wordpress to a static site. I chose zola as the site generator, because most of my documentation nowadays is in markdown anyway.
Syntax highlighting was a badly missed feature for me in the past. And zola delivers :-)
The only thing missing was syntax highlighting for console
(terminal) snippets.
I need it to display e.g.:
$ cd /lib/systemd/system
$ for i in fedora*storage* lvm2-monitor.* mdmonitor*.*; \
do sudo systemctl mask $i; \
done
with
```console
$ cd /lib/systemd/system
$ for i in fedora*storage* lvm2-monitor.* mdmonitor*.*; \
do sudo systemctl mask $i; \
done
```
TLDR: git repo
Using bash
as the language indicator does not really fit.
```bash
$ echo "Hello World" # comment
Hello World
$ echo -e ""
```
renders as
$ echo "Hello World" # comment
Hello World
$ echo -e ""
It does not honor the shell prompt, so I took the sublime files for bash
and extended them for console
.
```console
$ echo "Hello World" # comment
Hello World
$ echo -e ""
```
renders as
$ echo "Hello World" # comment
Hello World
$ echo -e ""
as would a
```bash
echo "Hello World" # comment
echo -e ""
```
echo "Hello World" # comment
echo -e ""
Note: as you can see, the echo
is not colored in the second line,
so I filed an issue
for the sublime bash syntax source.
I still have to figure out how to handle
```console
# echo "Hello World"
# echo "Hello World"
```
# echo "Hello World"
# echo "Hello World"
although this seems to work:
```console
# echo "Hello World"
Hello World
# echo "Hello World"
Hello World
```
# echo "Hello World"
Hello World
# echo "Hello World"
Hello World
Nevertheless, I uploaded the console sublime syntax to a git repo.
Feel free to use it.