关于Pandoc site上的列表的整个文档似乎是错误的,或者充其量是一团糟。
我主要解决了处理列表中多个段落的方式,但我坚持使用以下组合:代码块段落后面的文本段落不在列表中。也就是说,代码块段打破了列表(如latex .tex输出文件中所示;使用选项-t tex)。
如果以下Markdown文本在文件test.md中,我使用Pandoc作为
pandoc -t latex test.md -o test.pdf
如何格式化以下Markdown文本,以便第3段落在列表的第1项内并与第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
它应显示为:
// 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。列表项
但显示为
// 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段。然而,列表被打破,第3段脱落。
答案 0 :(得分:2)
关键是使用缩进和换行的正确组合:
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
这会产生