Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to convert a markdown file with html into pdf?

Is there a way of converting a markdown file with html code to a pdf? I have the following in Atom preview:

enter image description here

To get the red color I used the following:

# <span style="color:red">The Apolytikion in Tone 5 </span>

But when I convert it into a pdf file via Pandoc I get this,

enter image description here

Is there a way to keep the red color?

like image 260
Yocoxcanemitia Avatar asked Mar 04 '23 19:03

Yocoxcanemitia


1 Answers

Pandoc allows to select the PDF engine used for the conversion. The default is to go via LaTeX and pdflatex, HTML will be lost. However, there are other engines that use HTML: wkhtmltopdf, weasyprint, and prince (prince is not free). E.g.,

pandoc --pdf-engine=wkhtmltopdf …

The respective program must be installed separately and in your PATH. You can download wkhtmltopdf from wkhtmltopdf.org; for WeasyPrint see https://weasyprint.org.

like image 67
tarleb Avatar answered Mar 07 '23 09:03

tarleb