6

我正在使用jekyll.rb创建一个站点。
我有一个名为 about.html 的页面:

<div class="grid_10 page">
    {% include about_content.markdown %}
</div>

在 about_content.markdown 我有一些虚拟降价:

A First Level Header
====================

A Second Level Header
---------------------

Hello!

由于某种原因,当页面被渲染时,结果是这样的:

结果 http://gabrielecirulli.com/p/20120107-203135.png

即使我将 YAML 前面的内容添加到我的降价文件中,也没有任何变化。

这是我的 _config.yml

safe:        false
auto:        false
server:      false
server_port: 4000
baseurl:    /

source:      .
destination: ./_site
plugins:     ./_plugins

future:      true
lsi:         false
pygments:    false
markdown:    maruku
permalink:   date

maruku:
  use_tex:    false
  use_divs:   false
  png_engine: blahtex
  png_dir:    images/latex
  png_url:    /images/latex

rdiscount:
  extensions: []

kramdown:
  auto_ids: true,
  footnote_nr: 1
  entity_output: as_char
  toc_levels: 1..6
  use_coderay: false

  coderay:
    coderay_wrap: div
    coderay_line_numbers: inline
    coderay_line_numbers_start: 1
    coderay_tab_width: 4
    coderay_bold_every: 10
    coderay_css: style

如何让 jekyll 解释降价?

4

1 回答 1

14

您必须将其通过markdownify过滤器:

<div class="grid_10 page">
  {% capture about_content %}
    {% include about_content.markdown %}
  {% endcapture %}
  {{ about_content | unindent | markdownify }}
</div>

为了保持 Markdown 代码缩进但在降价之前删除缩进,我会编写一个专用插件,例如_plugins/unindent.rb

module Jekyll
  module UnindentFilter
    def unindent input
      input.lstrip
    end
  end
end

Liquid::Template.register_filter Jekyll::UnindentFilter
于 2012-01-08T12:21:38.857 回答