Search code examples
htmlpdfdocumentationeditormarkdown

How can I export Markdown documentation to different formats?


Writing Documentation

As a developer, I've been looking for the easiest way to write and update documentation. Not a boring text that screams "don't read me", but something happily (and easily) formatted with extra easy support for code.

From LaTeX to wiki to Markdown, just to name a few, I think Markdown is about as close as it gets. But the document itself is very nerdy and not very portable. This will need to become HTML and PDF.

Markdown Editor

So basically I am looking for an editor, converter, or any clever trick I haven't thought of, to turn this documentation into HTML and PDF.

Hands down the simplest editor I have found is StackEdit, but it doesn't export HTML well; it depends on online stylesheets that aren't linked properly and the exported HTML is pretty unbearable to see. It wouldn't work offline anyway.

Export HTML and PDF

I am looking for any way to do this properly. I don't mind if there's some stand alone application or script that converts the markdown file into proper HTML. I need someone to show me the tricks in documentation-generating that I can't find.

PDF is a different story. I think I spammed my computer full with HTML-to-PDF converters, and each of them added spam and watermarks to my awesomely clean documentation.


Solution

  • For choice of output formats, you probably can't beat pandoc - it will convert Markdown (and many other formats) into HTML, PDF, DocBook, and a number more. Its defaults are fairly sane, but you can include your own templates easily enough if you wish. It also has support for language-specific code highlighting in blocks.