【发布时间】:2015-05-10 12:18:09
【问题描述】:
我写了这个插件:
module Jekyll
module Tags
class Prism < Liquid::Block
def initialize(tag_name, text, tokens)
@arg = text.strip
super
end
def render(context)
output = super(context)
"<pre><code class=\"language-#{@arg}\">#{output}</code></pre>"
end
end
end
end
Liquid::Template.register_tag('prism', Jekyll::Tags::Prism)
我就是这样使用它的:
{% prism cpp %}
#include <iostream>
// Hello World
int main()
{
cout << "hello world" << endl;
int a = 10;
}
{% endprism %}
现在,问题是,我主要在我的网站上使用 C++ 代码。当我现在使用 Jekyll 生成此降价时,{% endprism %} 之后的所有文本仍将在 <pre> 标签内,因为 Kramdown 被 <iostream> 弄糊涂了正如预期的那样,但我的 Javascript Highlighter 变得混乱了。
如果不启用 Jekyll 的荧光笔,我该如何解决这种情况?
【问题讨论】: