Ruby – Jekyll not interpreting markdown

jekylljekyll-extensionsmarkdownrubyweb

I'm creating a site using jekyll.rb.
I have a page called about.html:

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

In about_content.markdown I have some dummy markdown:

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

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

Hello!

For some reason, when the page is rendered, the result is this:

result http://gabrielecirulli.com/p/20120107-203135.png

Even if I add the YAML front matter to my markdown file nothing changes.

This is my _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

How can I make jekyll interpret markdown?

Best Answer

You will have to pass it through the markdownify filter:

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

To keep the Markdown code indented but remove the indentation before markdownification, I would write a dedicated plugin, called for example _plugins/unindent.rb:

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

Liquid::Template.register_filter Jekyll::UnindentFilter