码字转换工具推荐——Pandoc
2021-04-27 本文已影响0人
mi_ng
Pandoc是使用Haskell语言编写的一款跨平台、自由开源及命令行界面的标记语言转换工具,可实现不同标记语言间的格式转换,堪称该领域中的“瑞士军刀”。
![](https://img.haomeiwen.com/i14782028/903dd89673f0faac.png)
Pandoc的使用示例
TxT转HTML(片段):
pandoc MANUAL.txt -o MANUAL.html
TxT转HTML(独立):
pandoc -s MANUAL.txt -o example2.html
带有目录,CSS和自定义footer的HTML:
pandoc -s --toc -c pandoc.css -A footer.html MANUAL.txt -o example3.html
TxT转LaTeX:
pandoc -s MANUAL.txt -o example4.tex
LaTeX转TxT:
pandoc -s example4.tex -o example5.text
reStructuredText:
pandoc -s -t rst --toc MANUAL.txt -o example6.text
富文本格式(RTF):
pandoc -s MANUAL.txt -o example7.rtf
投影仪幻灯片放映:
pandoc -t beamer SLIDES -o example8.pdf
DocBook XML:
pandoc -s -t docbook MANUAL.txt -o example9.db
手册页:
pandoc -s -t man pandoc.1.md -o example10.1
ConTeXt:
pandoc -s -t context MANUAL.txt -o example11.tex
将网页转换为MarkDown:
pandoc -s -r html http://www.gnu.org/software/make/ -o example12.text
MarkDown转pdf:
pandoc MANUAL.txt --pdf-engine=xelatex -o example13.pdf
ipynb (Jupyter notebook):
pandoc example15.md -o example15.ipynb
HTML幻灯片显示:
pandoc -s --mathml -i -t dzslides SLIDES -o example16a.html
pandoc -s --webtex -i -t slidy SLIDES -o example16b.html
pandoc -s --mathjax -i -t revealjs SLIDES -o example16d.html
Tex数学公式转HTML:
pandoc math.text -s -o mathDefault.html
pandoc math.text -s --mathml -o mathMathML.html
pandoc math.text -s --webtex -o mathWebTeX.html
pandoc math.text -s --mathjax -o mathMathJax.html
pandoc math.text -s --katex -o mathKaTeX.html
分隔代码块的语法突出显示:
pandoc code.text -s --highlight-style pygments -o example18a.html
pandoc code.text -s --highlight-style kate -o example18b.html
pandoc code.text -s --highlight-style monochrome -o example18c.html
pandoc code.text -s --highlight-style espresso -o example18d.html
pandoc code.text -s --highlight-style haddock -o example18e.html
pandoc code.text -s --highlight-style tango -o example18f.html
pandoc code.text -s --highlight-style zenburn -o example18g.html
GNU Texinfo转换为info和HTML格式:
pandoc MANUAL.txt -s -o example19.texi
makeinfo --no-validate --force example19.texi -o example19.info
makeinfo --no-validate --force example19.texi --html -o example19
OpenDocument XML:
pandoc MANUAL.txt -s -t opendocument -o example20.xml
ODT(OpenDocument文本,可由OpenOffice读取):
pandoc MANUAL.txt -o example21.odt
以上仅列举了Pandoc的少许样例,这把“瑞士军刀”的更多功能可以查看Pandoc官网,或者使用pandoc --help
进行学习!