Generating HTML from Markdown with Pandoc

DZone 's Guide to

Generating HTML from Markdown with Pandoc

· Web Dev Zone ·
Free Resource

I'm writing more and more things these days that are not code, and my content-managing toolchains are becoming more developed all the time. I've written in reStructuredText, Asciidoc and LaTeX, and today I'm working on an article that eventually wants to be HTML, but I'm creating it in Markdown because it's much easier.

My Swiss Army knife of document formats is a program called pandoc. It's absolutely fabulous, powerful and not too complicated, as long as you don't need to do anything too complicated. It will guess input and output formats from file extensions, or you can be more specific if you need to. Today's command looks like this:

pandoc article.md -o article.html

You won't be surprised to hear that this command takes a file called article.md, which contains my markdown, and outputs a file called article.html containing the HTML. I also use this to convert between all the various text markups and HTML, and also PDF and Office document formats. It's a very comprehensive tool!



Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}