3
我正在使用Maruku(Ruby)解析一些Markdown格式的文本。Maruku错误地解析第二行代码块?
This is a normal line
# pretend this line is empty
printf("First line of code is OK");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");
所以我的代码(我在我的MD文件由4个空格(或标签)缩进第一线,呈现一样:试图格式化像这样的code
块时,我有一个问题。我期望然而,我的代码第二行(由相同数量的空格缩进)结束了一个额外的4位被缩进生成HTML时
输出看起来是这样的:
This is a normal line
<pre><code>printf("First line of code is OK");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");</code></pre>
我已经用Gruber的“Dingus”测试了我的Markdown输入,并且它像我所期望的那样呈现(也就是说,在一个块中的两行代码都在同一级缩进)。但是对于Maruku来说,这是铺位。
我也试着用RDiscount,但是我得到了同样的效果。我正在使用Maruku,因为我需要定义列表。
怎么这么格式化它:
这是一个正常的线
printf("First line of code is OK\n");
printf("Second line of code (or any line thereafter) appears indented by an extra level, which is incorrect!");
非常感谢!我失去了一个早上试图找到原因,直到我缩小到Haml然后找到这个答案。 – 2015-06-05 06:18:18