将语法高亮添加到gh页面 [英] Add syntax highlighting to gh-pages

查看:93
本文介绍了将语法高亮添加到gh页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道每个页面都是通过Jekyll引擎运行的,并且提供了可以提供语法高亮显示给各种插件的gh页面的简单方法语法突出显示( ref )。但我不想安装博客。我只是希望语法突出显示适用于我的gh页面中的代码块。



我想我总是可以在我的gh页面中包含一个不同的插件...

解决方案

页面已经做了pygments,没有什么可安装的。

  --- 
布局:默认
标题:代码
---

快乐有趣的高亮。
[更多详情](https://github.com/mojombo/jekyll/wiki/liquid-extensions)

{%highlight ruby​​%}
def foo
放'foo'
结束
{%endhighlight%}


Is there an easy way to add syntax highlighting to my various plugin's gh-pages using github's Pygments?

I know that every page runs through the Jekyll engine and provides syntax highlighting (ref). But I don't want to install a blog. I just want syntax highlighting applied to the code blocks in my gh-pages.

I guess I could always just include a different plugin with my gh-pages...

解决方案

Pages already does pygments, there's nothing to install. Just use it!

---
layout: default
title: Something with codes
---

Happy fun highlighting. 
[More details](https://github.com/mojombo/jekyll/wiki/liquid-extensions)

{% highlight ruby %}
def foo
  puts 'foo'
end
{% endhighlight %}

这篇关于将语法高亮添加到gh页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆