Pandoc Markdown:带有代码块的多段落列表

Pandoc Markdown: Multiparagraph list with code blocks

Pandoc site 上有关列表的整个文档似乎都是错误的,或者充其量是一团糟。

我主要整理了处理列表中多个段落的方法,但我坚持使用以下组合:代码块段落后面的文本段落不在列表中 .也就是说,一个代码块段落打破了列表(如 latex .tex 输出文件中所见;使用选项 -t tex)。

如果以下 Markdown 文本在文件 test.md 中并且我使用 Pandoc 作为 pandoc -t latex test.md -o test.pdf

如何设置以下 Markdown 文本的格式,使第 3 段位于列表的第 1 项内并与其第一段对齐

   1. List item. Paragraph 1

   ```javascript
        // Second paragraph is a code block. If start at column 6, code shows ok.
        // Additional indentation only moves code block further right
        // Notice code block tag/backticks starts at column 1 though!!
        //  If it starts at col 2+, code block w/ tag is messed up as all code block.
        var x = 3
        print( "Pandoc has made a mess out of Markdown!" )
   ```

        Paragraph 3. However list is broken and Par 3 falls off.
   2. List item

它应该显示为:

  1. 列表项。第 1 段

// Second paragraph is a code block. If start at column 6, code shows ok. // Additional indentation only moves code block further right // Notice code block tag/backticks starts at column 1 though!! // If it starts at col 2+, code block w/ tag is messed up as all code block. var x = 3 print( "Pandoc has made a mess out of Markdown!" )

   Paragraph 3. However list is broken and Par 3 falls off.

2。列表项

而是显示为

  1. 列表项。第 1 段

// Second paragraph is a code block. If start at column 6, code shows ok. // Additional indentation only moves code block further right // Notice code block tag/backticks starts at column 1 though!! // If it starts at col 2+, code block w/ tag is messed up as all code block. var x = 3 print( "Pandoc has made a mess out of Markdown!" )

第 3 段。但是列表已损坏,Par 3 脱落。

  1. 列表项

关键是使用正确的缩进和换行符组合:

1. List item, no indention

    This paragraph is indented by two tabs (four spaces). 
    Put separating newlines below and above the following code chunk:

    ```javascript
    // This code chunk is indented by two tabs (four spaces)
    var x = 3
    print("Pandoc has made a mess out of Markdown!")
    ```

    Paragraph 3 is indented by two tabs.

2. List item, no indention

这会产生