我使用以下 Pandoc 命令将 HTML 转换为 Markdown
pandoc -f html -t commonmark myfile.html >myfile.md
Run Code Online (Sandbox Code Playgroud)
它工作得很好,但由于某种原因,它总是将表格转换为 html 编码的表格,而不是“markdown”表格(其中没有 html 标签)。有谁知道我如何强制 Pandoc 生成非 html 编码表?
这是完全可以的,因为你定义了commonmark输出,只是因为原始的 markdown 没有表格,并且建议用周围的语言做所有没有的事情。在本例中即为 html。
阅读https://daringfireball.net/projects/markdown/syntax你会看到 markdown 中允许使用 html。
实现pandoc 手册中提到的扩展 Markdown 输出:pandoc -f html -t markdown myfile.html >myfile.md在这里工作
结果:
--- --- ---
1 2 3
1 2 3
--- --- ---
Run Code Online (Sandbox Code Playgroud)
myfile.html:
<html><body>
<table>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>1</td><td>2</td><td>3</td></tr>
</table>
</body></html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5594 次 |
| 最近记录: |