Jekyll中的围栏代码块 [英] Fenced codeblocks in Jekyll

查看:245
本文介绍了Jekyll中的围栏代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将本地Jekyll安装升级到了Jekyll 3.0.2。

我期待在发布源代码时使用fenced(反引号)代码块。 / p>

然而,这并不奏效,我仍然需要使用Liquid标签来指定代码块。 我的构建设置在_config.yml中:

  baseurl:/ 
目的地:_site
永久链接:pretty
markdown:kramdown
kramdown:
input:GFM
syntax_highlighter:rouge



< h1>安装的Ruby gems列表

  activesupport(4.2.5.1)
addressable(2.3.8)
bigdecimal(1.2.6)
bundler(1.11.2)
coffee-script(2.4.1)
coffee-script-source(1.10.0)
colorator(0.1 )
ethon(0.8.1)
execjs(2.6.0)
法拉第(0.9.2)
ffi(1.9.10 x64-mingw32)
gemoji 2.1.0)
github-pages(45)
github-pages-health-check(0.6.0)
html-pipeline(2.3.0)
i18n(0.7。 0)
i o-console(0.4.3)
jekyll(3.0.2)
jekyll-coffeescript(1.0.1)
jekyll-feed(0.3.1)
jekyll-gist( 1.4.0)
jekyll-mentions(1.0.0)
jekyll-paginate(1.1.0)
jekyll-redirect-from(0.9.1)
jekyll-sass-转换器(1.3.0)
jekyll-seo-tag(0.1.4)
jekyll-sitemap(0.10.0)
jekyll-textile-converter(0.1.0)
jekyll-watch(1.3.1)
jemoji(0.5.1)
json(1.8.3,1.8.1)
kramdown(1.9.0)
liquid(3.0。 6)
听(3.0.5)
雇佣兵(0.3.5)
mini_portile2(2.0.0)
最少(5.8.4,5.4.3)
multipart-post(2.0.0)
net-dns(0.8.0)
nokogiri(1.6.7.2 x64-mingw32)
octokit(4.2.0)
power_assert(0.2 .2)
psych(2.0.8)
public_suffix(1.5.3)
rake(10.4.2)
rb-fsevent(0.9.7)
rb -inotify(0.9.5)
rdiscount(2.1.8)
rdoc(4.2.0)
redcarpet(3.3.3)
RedCloth(4.2.9)$ b $ (1.10.1)
safe_yaml(1.0.4)
sass(3.4.21)
sawyer(0.6.0)
终端表(1.5.2)
测试单元(3.0.8)
thread_safe(0.3.5)
typhoeus(0.8.0)
tzinfo(1.2.2)


解决方案

此配置适用于我。 $ b

_config.yml

 降价:kramdown 
kramdown:
输入:GFM
syntax_highlighter:rouge

test.md

  ####编写一个简单的C程序

```c

#include< ; stdio.h中>
int main(){
printf(Hello Drone \\\
);
返回0;
}
```

编译并运行本地系统上的程序来测试代码。


I have just upgraded my local Jekyll installation to Jekyll 3.0.2.

I was looking forward to use fenced (backticks) code blocks when posting source code.

This however doesn't work, and I still have to use Liquid tags to specify codeblocks

My build settings in _config.yml:

baseurl: /
destination: _site
permalink: pretty
markdown: kramdown
kramdown:
  input: GFM
  syntax_highlighter: rouge

List of Ruby gems installed

activesupport (4.2.5.1)
addressable (2.3.8)
bigdecimal (1.2.6)
bundler (1.11.2)
coffee-script (2.4.1)
coffee-script-source (1.10.0)
colorator (0.1)
ethon (0.8.1)
execjs (2.6.0)
faraday (0.9.2)
ffi (1.9.10 x64-mingw32)
gemoji (2.1.0)
github-pages (45)
github-pages-health-check (0.6.0)
html-pipeline (2.3.0)
i18n (0.7.0)
io-console (0.4.3)
jekyll (3.0.2)
jekyll-coffeescript (1.0.1)
jekyll-feed (0.3.1)
jekyll-gist (1.4.0)
jekyll-mentions (1.0.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.9.1)
jekyll-sass-converter (1.3.0)
jekyll-seo-tag (0.1.4)
jekyll-sitemap (0.10.0)
jekyll-textile-converter (0.1.0)
jekyll-watch (1.3.1)
jemoji (0.5.1)
json (1.8.3, 1.8.1)
kramdown (1.9.0)
liquid (3.0.6)
listen (3.0.5)
mercenary (0.3.5)
mini_portile2 (2.0.0)
minitest (5.8.4, 5.4.3)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.6.7.2 x64-mingw32)
octokit (4.2.0)
power_assert (0.2.2)
psych (2.0.8)
public_suffix (1.5.3)
rake (10.4.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.5)
rdiscount (2.1.8)
rdoc (4.2.0)
redcarpet (3.3.3)
RedCloth (4.2.9)
rouge (1.10.1)
safe_yaml (1.0.4)
sass (3.4.21)
sawyer (0.6.0)
terminal-table (1.5.2)
test-unit (3.0.8)
thread_safe (0.3.5)
typhoeus (0.8.0)
tzinfo (1.2.2)

解决方案

This configuration works for me.

_config.yml

markdown: kramdown
kramdown: 
  input: GFM
  syntax_highlighter: rouge

test.md

#### Writing a simple C Program

```c

#include <stdio.h>
int main(){
 printf("Hello Drone\n");
 return 0;
}
```

Compile and run the program on native system to test the code.

这篇关于Jekyll中的围栏代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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