两列Jekyll布局,用标签分隔?

我目前正在开发一个Jekyll博客,我想把我的降价文件放在这种格式中:

我希望我的代码块放在一列中,而其他所有内容(文本,标题等)都放在另一列中,以便我对我的代码进行并排解释。

有没有办法做到这一点? 在这方面,Markdown和Liquid模板引擎似乎非常严格。

谢谢!

通过将Twitter Bootstrap与模板引擎相结合,您可以获得所需的结果:

 
{{ include-code-blocks }}
{{ include-texts }} {{ include-headers }} {{ include-what-you-want }}

或者通过在html块中启用markdown处理来内联它们:

 # Apply this change to _config.yml file kramdown: # parse markdown inside block-level HTML tag parse_block_html: true 

并在markdown文件中使用它:

 
**some code block here** **another code block here**
**some text here** ##some header here ###something else here

有关markdown语法的信息: https : //github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet有关Jekyll降价处理器的信息: http : //kramdown.gettalong.org/documentation.html

如果我理解,你想并肩,液体/ jekyll代码和结果代码。 您正在使用twitter bootstrap作为css框架。

为了指示kramdown解析html块标记中的markdown,在_config.yml中添加:

 kramdown: # use Github Flavored Markdown input: GFM # do not replace newlines by 
s hard_wrap: false # parse markdown inside block-level HTML tag parse_block_html: true

在marwdown文件中,您现在可以使用{%raw%} {%endraw%}标记来指示不要解析的液体,而是“按原样”打印代码。

 
``` liquid {% raw %} {% if page.title == 'About' %} page.title = {{ page.title }} {% endif %} {% endraw %} ```
{% if page.title == 'About' %} page.title = {{ page.title }} {% endif %}

注意 :没有缩进。 这是因为kramdown将四个空格缩进视为代码块。 它将代码包装在code标记中。 不酷。

答案是肯定的 。 这很简单。 添加float:left到段落和代码块。 使用clear:left在p上clear:left 。 确保两个元素彼此相邻的空间足够。 添加overflow:auto到容器。 像这样: http : //codepen.io/anon/pen/grqRPr 。

您的Markdown文件(index.md):

 --- layout: default --- paragraph goes here ```` code goes here ```` paragraph goes here ```` code goes here ```` 

你的CSS文件(style.css):

 p, pre {float: left; width: 50%;} .container {width: 100%;} p {clear: left;} 

您的布局文件(default.html):

      
{{ content }}