安装Pandoc
1 | $ sudo apt-get install pandoc |
html输出(单文件):
1 | $ pandoc Release-Notest.md -o Release-Notes.html |
pdf输出(单文件):
1 | $ pandoc Release-Notest.md -o Release-Notes.pdf |
批量:
1 | $ ls *.md > 1.txt |
2 | $ cat 1.txt | while read line |
3 | > do |
4 | > pandoc $line -o $line.html -H header.txt -A footer.txt |
5 | > done |
-H FILE, –include-in-header=FILE
在header尾部插入文本中的内容.-B FILE, –include-before-body=FILE
紧跟body后部插入文本中的内容.-A FILE, –include-after-body=FILE
在body尾部插入文本中的内容.
# pandoc要求输入输出使用utf8编码,可以使用iconv命令进行编码转换
1 | $ iconv -t utf-8 input.txt | pandoc | iconv -f utf-8 |
更多:
https://pandoc.org/MANUAL.html