2018-06-12 Markdown to PDF

So I’m trying to move my list of spellcasters into a repository where I can start working on a PDF of sorts. I already knew that I didn’t want to try Pandoc. So here we are.

@mathieu suggested WeasyPrint. It converts HTML to PDF. It’s written in Python and I prefer that to the node module markdown-pdf. When I tried markdown-pdf, I had no access to the intermediary HTML and thus I didn’t know where to start when I tried writing a CSS for it.

So now I’m using WeasyPrint and that means I need a Markdown to HTML processor. Python already comes with Markdown and I just used it, yesterday. Perfect!

And now in my Makefile:

%.pdf: %.html
	weasyprint $< $@

%.html: %.md
	python3 -m markdown --extension=markdown.extensions.tables --file=$@ $<

I haven’t looked at fiddling with the CSS, though. I’m just happy that I access to the intermediary HTML file.

Tags:

Comments

PDF files:

– Alex Schroeder 2018-06-14 13:15 UTC


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.