Jekyll 默认的 markdown 引擎是kramdown。Rouge提供markdown的语法高亮功能。
Syntax highlighting with Jekyll – McPride's thougths
安装 rouge
gem install kramdown rouge
配置_config.yml如下:
markdown: kramdown
highlighter: rouge
kramdown:
input: GFM
syntax_highlighter: rouge
rouge创建css文件到对应的theme目录
root@VM-0-8-freebsd:/usr/local/www/myblog # bundle info --path minima
/usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1
root@VM-0-8-freebsd:/usr/local/www/myblog # cd /usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1
root@VM-0-8-freebsd:/usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1 # ls
LICENSE.txt README.md _includes _layouts _sass assets
root@VM-0-8-freebsd:/usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1 # mkdir -p assets/css/
root@VM-0-8-freebsd:/usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1 # rougify style github > assets/css/syntax.css
root@VM-0-8-freebsd:/usr/local/lib/ruby/gems/2.7/gems/minima-2.5.1 # ls assets/css/
syntax.css
个人测试了下,
thankful_eyes
style 看起来蛮舒服
修改_includes/head.html , 引用rouge创建的css文件。添加如下
<head>
...
<link rel="stylesheet" href="/assets/css/syntax.css" />
</head>
网友评论