Pandoc & Markdown: Colored links in PDF output

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
peter_b
Chatterbox
Posts: 383
Joined: Tue Nov 12, 2013 2:05 am

Pandoc & Markdown: Colored links in PDF output

Post by peter_b »

I've become a big fan of using Markdown in combination with Pandoc for writing stuff of all sorts: documentation, articles, etc.

But when rendering to PDF output, the default for HTML-links is not optically distinguishable from regular text. So links are practically invisible in the resulting PDF :(

Here are different options for making the links visible (=formatting them):

1) Underline links
Add the following to the Pandoc YAML-header block in your Markdown file:

Code: Select all

header-includes:
  - \hypersetup{colorlinks=false,
      allbordercolors={0 0 0},
      pdfborderstyle={/S/U/W 1}}
This will give you black-colored, but underlined hyperlink references.
Change the "colorlinks=false" to "true" and you'll get the links colored in pink :P

2) Color links
If you don't want/need your links underlined, but simply want the visible - in a different color, just add the following option to the YAML-header block:

Code: Select all

linkcolor: blue
Better! 8)

Links:
Why are my hyper references pink?
Pandoc Manual: Metadata Blocks
Post Reply