Pandoc 安装
mac > brew install pandoc
windows > https://github.com/jgm/pandoc/releases/latest
linux > https://github.com/jgm/pandoc/releases/latest
Pandoc支持读取格式:
Markdown, CommonMark, PHP Markdown Extra, GitHub-Flavored Markdown, MultiMarkdown, (subsets of) Textile,
reStructuredText, HTML, LaTeX, MediaWiki markup, TWiki markup, TikiWiki markup, Creole 1.0, Haddock markup,
OPML, Emacs Org mode, DocBook, JATS, Muse, txt2tags, Vimwiki, EPUB, ODT, Word docx.
Pandoc支持输出格式:
Markdown, CommonMark, PHP Markdown Extra, GitHub-Flavored Markdown, MultiMarkdown, reStructuredText, XHTML,
HTML5, LaTeX (including beamer slide shows), ConTeXt, RTF, OPML, DocBook, JATS, OpenDocument, ODT,
Word docx, GNU Texinfo, MediaWiki markup, DokuWiki markup, ZimWiki markup, Haddock markup,
EPUB (v2 or v3), FictionBook2, Textile, groff man, groff ms, Emacs Org mode,
AsciiDoc, InDesign ICML, TEI Simple, Muse, PowerPoint slide shows and Slidy, Slideous,
DZSlides, reveal.js or S5 HTML slide shows.
命令实例:
转换 test.md 输出 test.doc
pandoc test.md -o test.doc
指定样式 test.css 转换 test.md 输出 test.doc
pandoc test.md -o test.doc -c test.css
获取url内容转换md
pandoc -f html -t markdown http://www.axdict.com
注意
Pandoc对于输入和输出都使用UTF–8字符编码。
如果你的本地字符编码不是UTF–8,你应该通过iconv传送输入和输出:
iconv -t utf-8 input.txt | pandoc | iconv -f utf-8