Pandoc is one of the most useful command-line document converters I've used. Entire websites can be generated from simple text files. I'm partial to the Markdown syntax, but really any plain-text file can be read into Pandoc and it will output HTML, PDF, and even Word Docs. This website for instance is built using a single
Makefile that runs a Pandoc command.
pandoc -r markdown+simple_tables+table_captions+yaml_metadata_block+auto_identifiers +header_attributes+fenced_code_blocks+fenced_code_attributes+tex_math_dollars -w html --toc --mathjax --include-before-body=$(PANDOC)/navigation.html --template=$(PANDOC)/layout.html --css=$(PANDOC)/style.css -o $(ROOT)/$@ $<
Basically, for every Markdown
.md file in the directory, Pandoc converts it to an HTML file styled using a given template. The Markdown file supports YAML headers and the variables are made available in the template file. Templates also support basic logic (
if/else) and loops (
for), which allows for some very smart template files that can change the HTML output based on the YAML headers in your Markdown file.
Pandoc also support syntax highlighting for embedded code.