rubyrubygemsredcarpetslate-docs

Markdown not interpreted by Ruby redcarpet correctly


I have a following markdown for my slate project:

---
title: API Reference
language_tabs:
  - http
  - javascript
search: true
---
# Getting Started
## Logout
# Call Management
## Call States
```javascript
{
}
```
## Call Notification
## Caller ID Called Number
## Call Information During Call

And I use middleman to serve a site: bundle exec middleman server. However, the last subsection title is not interpreted correctly as a h2 tag (screenshot). The result is the same if I build it through rake build.

However, if I put this markdown on other interpreters like http://stackedit.io, it is fine.

So I suspect that my markdown interpreter (Ruby redcarpet) is broken somehow. I did not get any warning/error message on the console. I tried different versions of redcarpet. The interpreted HTML is also erroneous, although errors are different. I suppose some combination of Ruby and Redcarpet will make it?

Here is my config.rb:

# Markdown
set :markdown_engine, :redcarpet
set :markdown,
fenced_code_blocks: true,
smartypants: true,
disable_indented_code_blocks: true,
prettify: true,
tables: true,
with_toc_data: true,
no_intra_emphasis: true

Could anybody tell what the probable cause is? Or how to recover?

enter image description here


Solution

  • Updating to the newest version (3.3.3) of RedCarpet solved my problem.


    Update 1

    Well, it still has problems: I cannot change even a single letter inside the Markdown file. Otherwise, the generated HTML markup screws up again...


    Update 2

    Finally solved. Switching RedCarpet to kramdown solved it.

    My config.rb:

    # set :markdown_engine, :redcarpet
    set :markdown_engine, :kramdown
    set :markdown,
        fenced_code_blocks: true,
        smartypants: true,
        disable_indented_code_blocks: true,
        prettify: true,
        tables: true,
        with_toc_data: true,
        no_intra_emphasis: true