Markdown没有正确解释Ruby的redcarpet(Markdown not interpreted by Ruby redcarpet correctly)

我为我的slate项目准备了一个下面的markdown:

--- 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

我使用middleman服务于一个网站: bundle exec middleman server 。 但是,最后一个小节标题不能正确解释为h2标签(截图)。 如果我通过rake build它,结果是一样的。

但是,如果我把这个减价放在像http://stackedit.io这样的其他解释器上,那很好。

所以我怀疑我的标记解释器( Ruby红毯 )是不知何故中断的。 我没有在控制台上收到任何警告/错误消息。 我尝试了不同版本的redcarpet。 解释的HTML也是错误的,尽管错误是不同的。 我想有一些Ruby和Redcarpet的组合会成为它?

这是我的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

有人能说出可能的原因是什么吗? 或者如何恢复?

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?

最满意答案

更新到RedCarpet的最新版本(3.3.3)解决了我的问题。


更新1

那么,它仍然存在问题:我甚至无法更改Markdown文件中的单个字母。 否则,生成的HTML标记再次拧紧...


更新2

终于解决了。 切换RedCarpet kramdown解决了它。

我的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

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: trueMarkdown没有正确解释Ruby的redcarpet(Markdown not interpreted by Ruby redcarpet correctly)

我为我的slate项目准备了一个下面的markdown:

--- 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

我使用middleman服务于一个网站: bundle exec middleman server 。 但是,最后一个小节标题不能正确解释为h2标签(截图)。 如果我通过rake build它,结果是一样的。

但是,如果我把这个减价放在像http://stackedit.io这样的其他解释器上,那很好。

所以我怀疑我的标记解释器( Ruby红毯 )是不知何故中断的。 我没有在控制台上收到任何警告/错误消息。 我尝试了不同版本的redcarpet。 解释的HTML也是错误的,尽管错误是不同的。 我想有一些Ruby和Redcarpet的组合会成为它?

这是我的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

有人能说出可能的原因是什么吗? 或者如何恢复?

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?

最满意答案

更新到RedCarpet的最新版本(3.3.3)解决了我的问题。


更新1

那么,它仍然存在问题:我甚至无法更改Markdown文件中的单个字母。 否则,生成的HTML标记再次拧紧...


更新2

终于解决了。 切换RedCarpet kramdown解决了它。

我的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

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