Pandoc

From Han Wiki
Jump to navigation Jump to search

pandoc: a universal document converter

$ pandoc [options] [input-file]

# -o/--output
$ pandoc -o output.html input.txt

# -s/--standalone: product a standalone document rather than a document fragment
$ pandoc -s -o output.html input.txt

# -f/--from: input format
# -t/--to: output format
$ pandoc -f html -t markdown hello.html

# pandoc uses utf-8 by default, but if it is not pipe input & output through iconv
$ iconv -t utf-8 input.txt | pandoc | iconv -f utf-8

# produce a pdf file
$ pandoc test.txt -o test.pdf

# read from web
$ pandoc -f html -t markdown https://www.fsf.org

# provide custom agent
$ pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" https://www.fsf.org

for more info: https://pandoc.org/MANUAL.html