I'm looking for a lightweight php library that can load a markdown file (it doesn't matter what flavor of markdown) and generate the corresponding HTML. I also need to be able to generate PDFs from the markdown, and ebook files would be awesome as well.

2 Answers 2


I'm quite happy with Markdown Extra, which I e.g. use for my website. It's completely open source (available at Github), well documented, and a breeze to use. It supports "standard Markdown" and, via its Extra module, a bunch of additional features like tables, fenced code blocks, footnotes, and more.

Unfortunately, I cannot see it having PDF support built-in. So when deciding for it, you might need a second library for that. I've never needed that combination, but where I'm using PHP to create PDF documents, I'm using TCPDF for that – which again is free, open source, and produces pretty good results.

No recommendation towards eBooks currently – but that being a nice-to-have, I hope my answer is acceptable without it.

  • PS: For the eBook part, I recently found PHPePub. Have not tried it yet, but definitely seems to be worth a look.
    – Izzy
    May 18, 2015 at 15:48

Haskell rather than PHP but also standalone and with PHP bindings available and cross platform I would recommend Pandoc:


Input formats:

docbook, haddock, html, json, latex, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, opml, org, rst, textile

Output formats:

asciidoc, beamer, context, docbook, docx, dzslides, epub, epub3, fb2, html, html5, icml, json, latex, man, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, odt, opendocument, opml, org, pdf*, plain, revealjs, rst, rtf, s5, slideous, slidy, texinfo, textile

  • i'm afraid i don't have access to install software on the server... otherwise, this would be perfect. Jan 17, 2015 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.