我的机器上最新安装的 Pandoc(pandoc 1.13.2.1)版本似乎有问题。使用之前安装的版本,从 Markdown 到纯文本的转换将生成'Setext-style headers---'=' for H1 and '-' for H2---纯文本输出。此外,我还注意到两个不确定的问题:
在过去的几分钟里,我一直在玩不同的 pandoc 选项,但运气不佳。
如何将插图 #1转换为插图 #3
环境 pandoc (pandoc 1.13.2.1) Kubuntu 15.10
插图 #1:输入 Markdown 文件
# Title
## Section
* This is the section.
### Subsection
* This happens to be the subsection
Run Code Online (Sandbox Code Playgroud)
插图#2:运行后输出纯文本 pandoc -f markdown -t plain pandoc_markdown_issue.md
TITLE
Section
- This is the section.
Subsection
- This happens to be the subsection
Run Code Online (Sandbox Code Playgroud)
插图 #3:所需的输出
Title
=====
Section
-------
- This is the section.
Subsection
----------
- This happens to be the subsection
Run Code Online (Sandbox Code Playgroud)
小智 9
我可以通过完全省略-f和-t标志并让 Pandoc 从输出文件扩展名推断转换格式来实现您想要的输出:
pandoc file.md -o file.txt
Run Code Online (Sandbox Code Playgroud)
或者,使用-t plain似乎也有效:
pandoc -f markdown -t plain file.md -o file.txt
Run Code Online (Sandbox Code Playgroud)
不太确定为什么第一个例子有效。我的猜测是它是 Markdown 阅读器之一,因为有多个。
| 归档时间: |
|
| 查看次数: |
3726 次 |
| 最近记录: |