diagonalbatman
diagonalbatman

Reputation: 18012

Convert Markdown + CSS to .doc or .pdf

Been using Markdown using Mou on the Mac alot recently, and would really like to use it in my technical writing - it is much easier than messing around with .doc formats.

The question is what is the best way to convert to a .doc format or a .pdf, i will need elements like repeating headers / footers, but other than that i just need the HTML / CSS to break sensibly accross pages.

Actually i guess what i am asking - is how do i print my styled Markdown output in a sensible fashion to .doc / .pdf in A4 or standard paper sizing.

Upvotes: 7

Views: 8290

Answers (6)

Dre
Dre

Reputation: 2953

You could also try Marked by Brett Terpstra. It handles custom CSS and outputs to a variety of formats, including PDF, with page breaks. It's not free, but it is great and worth the - very reasonable - price.

Upvotes: 0

samssan
samssan

Reputation: 403

My solution (for windows) was to install wkhtmltopdf, which works through cmd, and then call it in r using the r base command shell.

You can call it in r by the following line:

shell('"c:\\...\\wkhtmltopdf\\bin\\wkhtmltopdf.exe" c:\\...inputdestination...\\htmlFile.html c:\\...outputdestination...\\nameForPdf.pdf')

The htmlFile.html and the (htmlFile_files) folder containing .css file need to be in the same folder.

Upvotes: 0

Matthew Strawbridge
Matthew Strawbridge

Reputation: 20640

You could consider using Pandoc, AsciiDoc or reStructuredText. They're similar to Markdown – simple plain text formats – but have plenty of support for publishing to a variety of formats.

Upvotes: 2

Connor Doyle
Connor Doyle

Reputation: 1912

I'm trying this for technical docs as well. The best tool I found to generate PDFs is gimli. In our environment:

  1. Markdown source is stored in a git repository on a central server.
  2. Jenkins polls that git repo for changes on master
  3. The Jenkins job fetches the changes and publishes HTML and PDF versions to the intranet.

Works a treat so far.

Upvotes: 2

illbzo1
illbzo1

Reputation: 470

You can also generate HTML from Markdown and convert it to .pdf or .xls format using DocRaptor. DocRaptor also handles CSS better than competitors do.

Here's a link to DocRaptor

Upvotes: 3

tkone
tkone

Reputation: 22758

I'm generating HTML from my markdown and then using htmldoc to generate PDF files. Htmldoc gives you a ton of control over how your file formats. Not sure if you can get it to read in a CSS file as well, but the docs might help.

Upvotes: 0

Related Questions