如何在 Jekyll/Pygments 中突出显示 CSHTML

How to highlight CSHTML in Jekyll/Pygments

我正在使用 Pygments 在 Jekyll 中突出显示代码片段。

我想知道如何使用 Pygments 荧光笔突出显示 .cshtml/.aspx 文件

Here are the available lexers in Pygments. Since ASPX might contain C# or VB, it should be supported in Pygments since it is on the supported languages list.

您要查找的相关内容是 aspx-csaspx-vb,因为它们突出显示了 ASPX 代码片段。

{% highlight aspx-cs %}

   //your aspx code here 

{% endhighlight %}

或者如果那些 aspx 代码片段主要包含静态 html 或 xhtml,您应该可以 {% highlight html %}.

CSHTML 应该只使用 csharpc# 作为简称。

可读的语言参考列表及其简称 are found here