themthem
themthem

Reputation: 543

How can I convert markdown to PDF using CSS with a table of contents?

I tried using the Pandoc and Wkhtmltopdf, and Wkhtmltopdf is working fine. But I am unable to get a table of contents and page numbering. Is there a way to get those using Pandoc?

Edit:

I would like to add another potential solution that has helped me. It is PagedMeda/Paged.js. I allows for the usage of PagedMedia CSS, which you can use to make a table of contents.

Upvotes: 0

Views: 1039

Answers (1)

mb21
mb21

Reputation: 39189

Pipe the output to wkhtmltopdf and use its table of contents producer (pandoc --toc doesn't do page numbers):

pandoc input.md -s -t html | wkhtmltopdf toc - output.pdf

Upvotes: 3

Related Questions