A small utility to convert markdown to html (for publishing on social media, Medium, etc)


Are you aware of GitHub - straight-shoota/md2pdf: Convert markdown files to pdf with flexible template and stylesheet?
It can do pretty much the same thing but with more features and flexibility. (main purpose is to finally generate a PDF, but HTML is produced as well).


I was not aware of it.

Another way to do it is convert your markdown file to pdf (or mobi or epub) using Calibre.

Calibre, in turn can be used as an application or it can be used on the command-line.

In turn you can build an API for Calibre using system calls (Process.exec()) and by calling Calibre functions with all sorts of arguments.

The result is as portable (in this case) as Calibre.


I have a pet project on my queue waiting for years… that is get GitHub - litehtml/litehtml: Fast and lightweight HTML/CSS rendering engine and some library that can generate pdfs and create a HTML->pdf renderer that doesn’t depend on X, Qt, GTK, etc… i.e. doesn’t depend on wkhtmltopdf.

But unfortunately this project couldn’t be written in Crystal because the idea is to expose a C API, so any other language could use it with no problems.

1 Like