Maruku (Ruby) を使用して、Markdown 形式のテキストを解析しています。code次のようなブロックをフォーマットしようとすると問題が発生します。
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 つのスペース (またはタブ) でインデントした) は、期待どおりにレンダリングされます。ただし、コードの 2 行目 (まったく同じ数のスペースでインデントされています) HTML が生成されると、余分な 4 つのスペースでインデントされます。
出力は次のようになります。
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>
Markdown 入力を Gruber の「Dingus」でテストしたところ、期待どおりにレンダリングされました (つまり、両方のコード行が 1 つのブロックにあり、両方とも同じレベルでインデントされています)。でもマルクなら二段ベッド。
RDiscount でも試してみましたが、同じ効果が得られます。定義リストが必要なので、Maruku を使用しています。
SO がどのようにフォーマットするか:
これが普通のライン
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!");