What language code in the language hint should I use for code blocks for ASP.NET MVC Razor views?
<!-- language: lang-razor -->
doesn't seem to work.
Your syntax is not correct. The syntax of a language code should be:
<!-- language: lang-razor -->
However, Razor is not in the list of supported languages.
lang-razor
is now fully supported github.com/highlightjs/highlight.js/blob/main/…. An example: stackoverflow.com/a/77554464/2987689
Commented
Nov 27, 2023 at 4:05
The best answer I've come up with so far is just to not use the language hint on these code blocks, but tag the question with asp.net-mvc
or asp.net-mvc-4
. If I do that, it syntax highlights both the html and the c# in the razor code. It does not seem to work with asp.net-mvc-5
question tag alone, however. A tag for the question highlights un-hinted code in the answers correctly as well.