Is there any direct way to generate pdf from markdown file by python

guilin 桂林 picture guilin 桂林 · Nov 9, 2010 · Viewed 21.8k times · Source

As the title, I want to use markdown as my main write format and I need to generate PDF files from markdown using pure python.

Answer

JasonFruit picture JasonFruit · Nov 9, 2010

I have done and would do it in two steps. First, I'd use python-markdown to make HTML out of my Markdown, and then I'd use xhtml2pdf to make a PDF file.

Edit (2014):

If I were doing this now, I might choose WeasyPrint as my HTML-to-PDF tool; it does a beautiful job, and I've used it on a couple projects recently.