Jekyll语法高亮不工作 - 类未添加 [英] Jekyll Syntax Highlighting Not Working - Classes Are Not Being Added

查看:192
本文介绍了Jekyll语法高亮不工作 - 类未添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在我的Jekyll-powered博客上使用语法高亮。

I cannot get syntax highlighting to work on my Jekyll-powered blog.

开发文件可以在这里找到: https://github.com/StevenXL/stevenxl.github.io

The development files can be found here: https://github.com/StevenXL/stevenxl.github.io.

正如你所看到的,在我的 _config。 yml 文件,我有以下:

As you can see, in my _config.yml file, I have the following:

markdown: kramdown

kramdown:
  syntax_highlighter: rouge

在我的 css / custom。 css 文件,我导入CSS文件以使用@import命令突出显示语法。

In my css/custom.css file, I am importing the CSS file to highlight the syntax with an @import command.

用于突出显示 css / monokai.css 中的实际CSS文件。

The actual CSS file for highlighting lives in css/monokai.css.

我不知道我做错了什么。这似乎在我的本地预览当我运行 jekyll服务,但不是当我推动开发文件到GitHub。它似乎没有添加正确的类, 。

I am not sure what I am doing wrong. This seems to work fine on my local preview when I run jekyll serve but not when I push the development files to GitHub.It doesn't seem to be adding the correct classes when built by GitHub.

推荐答案

我有同样的问题使用 monokai jekyll-uno 主题突出显示css。

I had the same issue using the monokai highlighting css from the jekyll-uno theme.

为了解决这个问题,我不得不更新CSS,使用胭脂本身是相当简单的(取自 docs ):

To solve the problem I had to update the CSS, using rouge itself is quite straightforward (taken from the docs):

rougify style monokai> css / monokai.css

其他主题

这篇关于Jekyll语法高亮不工作 - 类未添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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