Luca Spiller
Luca Spiller

Reputation: 2288

Converting multiple Markdown files with links to PDF

I've written a load of technical documentation in Markdown. I chose to use this for versioning and so we can view in on GitHub.

We now need to share this with external users (who aren't as comfortable with Markdown), so I would like to convert it to PDF.

Gimli seems to be the best tool I have found for the conversion (it uses the same stylesheet as GitHub so it looks the same), however it doesn't convert the links as well. Is there anything that'll also do this?

Upvotes: 40

Views: 40781

Answers (4)

unrealapex
unrealapex

Reputation: 630

Adding to Sonson123's answer, if you need to convert all the Markdown files in a directory, you can use find.

pandoc $(find . -type f -name "*.md") -o result.pdf

Upvotes: -1

jkjung13
jkjung13

Reputation: 944

I use named anchor tags in my markdown document. And I make links to these names. For example,

<a name="#1-overview"></a>
##1. Overview

......

Reference: [1. Overview](#1-overview)

Then I use Typora to open the markdown document and export it to PDF. The resulting PDF preserves these internal links properly.

Upvotes: 1

PerfectlyRock
PerfectlyRock

Reputation: 413

NO!!! You really don't have to do this!!! Simply " cat *.md > allpages.md " (you may want to organize the order manually or setup each file in a proper name to let cat work) then open the allpages.md then choose print / export in any markdown editor!!!!

You don't have to install ANYTHING!!!!

Upvotes: -14

Sonson123
Sonson123

Reputation: 11437

I don't know with which type of links you have problems (inline links, reference links, HTML links, image links, automatic links...), but you can try to use Pandoc:

pandoc *.md -o result.pdf

This will convert all files with the *.md file extension to a single pdf.

Upvotes: 39

Related Questions