Pandoc 4 级降价 Headers

Pandoc 4th Level Markdown Headers

我正在努力将一堆 orgmode 文件转换为 markdown。我一直无法找到如何防止 pandoc 将大于 3 级的标题转换为编号列表。例如:

* Heading 1

Here is some content

** Heading 2

Here is some content

*** Heading 3

Here is some content

**** Heading 4

Here is some content

***** Heading 5

Here is some content

**** Another Heading 4

Here is some content

***** Another Heading 5

Here is some content

正在使用此命令进行转换:pandoc -f org -t gfm --atx-headers myfile.org

此输出结果:

# Heading 1

Here is some content

## Heading 2

Here is some content

### Heading 3

Here is some content

1.  Heading 4
    
    Here is some content
    
    1.  Heading 5
        
        Here is some content

2.  Another Heading 4
    
    Here is some content
    
    1.  Another Heading 5
        
        Here is some content

如何让标题 4 和标题 5 成为实际标题而不是编号列表?

谢谢

Org 模式使用 H export setting 来控制此行为:

Set the number of headline levels for export (org-export-headline-levels). Below that level, headlines are treated differently. In most back-ends, they become list items.

Pandoc 尊重此设置。在 Emacs Org-mode 和 pandoc 中,默认值为 3.

因此,您的问题的解决方案是将其设置为更高的值。要么将其添加到您的组织文件的顶部:

#+OPTIONS: H:9

或者,如果您使用的是 Mac 或 Linux,请使用您的 shell 的进程替换功能在您的输入前添加以下行:

pandoc -f org -t gfm --atx-headers <(printf "#+OPTIONS: H:9") myfile.org