Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. It can convert from/to multiple formats including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx and can produce PDF output.