markdown - 使用 markdown 突出显示代码会生成内联代码块
问题描述
我试图在我的网站上突出显示Jekyll 生成的代码块。目前,我正在使用 ``` markdown 格式来突出显示代码。但它不起作用。它不是突出显示整个块,而是突出显示像这样的单个行 -
我也尝试使用 {% highlight %} 标签,但产生相同的结果。如果我使用 {% highlight linenos %},它似乎会以某种方式工作并产生一个块。
生成的代码是 -
<pre><code class="language-C#">public override void AwakeFromNib()
{
base.AwakeFromNib();
AttributedStringValue = new NSAttributedString(StringValue, new NSStringAttributes()
{
// You can change the color of link after uncommenting the following
// ForegroundColor = NSColor.Red,
UnderlineStyle = NSUnderlineStyle.Single.GetHashCode()
});
hoverarea = new NSTrackingArea(Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null);
AddTrackingArea(hoverarea);
cursor = NSCursor.CurrentSystemCursor;
}
</code></pre>
我无法弄清楚为什么没有突出显示整个块。
编辑:添加生成上述结果的代码块 -
6. {: .lh-copy }Now we need to style the text field so that it looks like a hyperlink. To do this we override the AwakeFromNib() method as below -
```C#
public override void AwakeFromNib()
{
base.AwakeFromNib();
AttributedStringValue = new NSAttributedString(StringValue, new NSStringAttributes()
{
// You can change the color of link after uncommenting the following
// ForegroundColor = NSColor.Red,
UnderlineStyle = NSUnderlineStyle.Single.GetHashCode()
});
hoverarea = new NSTrackingArea(Bounds, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveAlways, this, null);
AddTrackingArea(hoverarea);
cursor = NSCursor.CurrentSystemCursor;
}
```
解决方案
推荐阅读
- ios - 如何将 UIImageVIew 实时移动到 UILabel 的位置?
- java - 在 if 语句中比较 AssertNull
- php - 如何测试一个对象是用 PHP 工厂的正确构造函数参数创建的?
- javascript - Google Apps 脚本:返回具有在另一个数组中指定的列的数组
- python-3.x - 使用 yolov3 进行对象检测和分类
- html - 在 Django 中修改 login.html 文件
- pip - 永久图书馆 Colab - 依赖项
- matlab - While 循环和收敛测试
- python - Colab 中的动画参数函数
- node.js - Imap nodejs 将电子邮件保存为 .pst 文件