我需要从Pygments为我的jekyll博客生成一个css文件,以启用丰富多彩的代码片段? [英] Do I need to generate a css file from Pygments for my jekyll blog, to enable colorful code snippet?

查看:343
本文介绍了我需要从Pygments为我的jekyll博客生成一个css文件,以启用丰富多彩的代码片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次使用Jekyll和Pygments。但我不知道如何插入丰富多彩的代码片段。

This is my first time to use Jekyll and Pygments. But I don't know how to insert colorful code snippet.

我成功安装了Pygments,按照官方步骤,标记如下:

I successfully installed Pygments, following the official steps, with the markdown like this:

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

我看到html源代码包括类,但是这个代码片段没有颜色。

I see the html source code including the classes, however there is no color for the this snippet.

我需要从Pygments生成一些css文件并包括它们吗?如何?

Do I need to generate some css files from Pygments and include them? And how?

推荐答案

您需要包含syntax.css

You need to include syntax.css

您可以从我的repo中获取示例
https:// github.com/madhur/madhur.github.com/blob/master/files/css/syntax.css

You can take the sample from my repo https://github.com/madhur/madhur.github.com/blob/master/files/css/syntax.css

,然后根据您的主题自定义。 Mine是为深色背景定制的。

and then customize it according to your theme. Mine is customized for dark backgrounds.

这篇关于我需要从Pygments为我的jekyll博客生成一个css文件,以启用丰富多彩的代码片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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