Pandoc文档格式转换工具


如果您需要将文件从一种标记格式转换为另一种标记格式,那么pandoc就是您的瑞士军刀。

Pandoc文档格式转换工具

OpenSource: 总结的快捷键使用文档

Pandoc文档格式转换工具


1. 格式转换

具体的各种格式之间的转换,请看文末的图谱

Pandoc文档格式转换工具


2. 安装方式

几乎支持各种操作系统和平台,使用无忧

  • MacOS
# brew
brew install pandoc-citeproc
brew install librsvg python homebrew/cask/basictex
  • Linux
# apt
apt install pandoc
apt install pandoc-citeproc

# download dpkg
https://packages.ubuntu.com/pandoc
  • Windows
# download exe
https://github.com/jgm/pandoc/releases/latest

# using chocolatey
choco install pandoc
choco install rsvg-convert python miktex

3. 使用方式

转换原来,如此简单 => 官网使用参考地址

  • xxx => docx
# txt to docx
$ pandoc -s MANUAL.txt -o example29.docx

# LaTeX math to docx
$ pandoc -s math.tex -o example30.docx

# Markdown to docx
$ pandoc -s m.md -o m.docx

# Docx with a reference docx:
$ pandoc --reference-doc twocolumns.docx -o UsersGuide.docx MANUAL.txt
  • md => xxx
# markdown转换为html
$ pandoc README.md -o README.html

# markdown转换为word
$ pandoc README.md -o README.docx

# markdown转换为pdf(latex之前是双短横线)
$ pandoc README.md -o README.pdf --latex-engine=xelatex
  • others
# EPUB to plain text
$ pandoc MANUAL.epub -t plain -o example36.text
  • 注意事项
# 通过-V参数指定中文字体
-V mainfont="SimSun"

# 解决中文乱码
$ pandoc -V mainfont="SimSun" --reference-doc twocolumns.docx -o UsersGuide.docx MANUAL.txt

Pandoc文档格式转换工具


文章作者: Escape
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Escape !
  目录