On a few occasion, I've seen code blocks such as:
#! /bin/zsh -
echo foo/*
echo this is not part of a C comment.
Being highlighted as C code even though the Q&A had a zsh tag and the shebang made it explicit what language the code is written in.
I feel like it should be relatively easy for the syntax highlighting code to detect this kind of situation and select the zsh
syntax highlighter automatically here based on the shebang.
In any case, that's not limited to zsh
, zsh
just happens to be the language I use in most of my posts here. It would be useful for code blocks starting with #! /bin/bash -
/ #! /usr/bin/perl --
, etc as well.