Fenced codeblocks in Jekyll

这一生的挚爱 提交于 2019-12-23 02:34:23

问题


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)

回答1:


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.


来源:https://stackoverflow.com/questions/35189481/fenced-codeblocks-in-jekyll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!