Content inside block code with a language name will be parsed as verbatim code, as-is without any specific parsing. You can't use markdown syntax inside code blocks - this is not supported by Pandoc.
You would need to generate HTML directly after the knitting step. For that, You can use external post-processing of the code block for your rendered output (like HTML processing) to tweak the output.
Some R packages like flair may help you:
Maybe it can be used to produce sh code block too - not sure about that I did not try but you should check it out