Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force pandoc not to build <a> tag when url is in YAML metadata

Tags:

Let's say we have simple empty .Rmd file with YAML metadata like this

---
link: https://google.com
---

Then in html template, it will show up automatically in <a> tag

<a href="http://google.com" class="uri">http://google.com</a>

How to force pandoc not to build <a> when there is url in YAML? I mean what I wanna finally get is plan text in html template

http://google.com

Or if I use own html template I can add a link that way

<a href="$link$">Google</a>

Thanks for help!

like image 799
Nicolabo Avatar asked Nov 03 '17 12:11

Nicolabo


1 Answers

This is caused by an extension that is enabled by default with the md_extensions option under the output format, specifically auto_link_bare_uris. You can disable this in your YAML header.

---
title: https://www.google.com
output:
  html_document:
    md_extensions: -autolink_bare_uris
---

Just note that this will affect auto linking of URIs throughout your document, not only in the title. After disabling the extension you will need to enclose links in angle brackets to create links, i.e. <https://www.google.com>. The Pandoc guide and the R Markdown site contain the detail covering this.

like image 65
Kevin Arseneau Avatar answered Sep 20 '22 13:09

Kevin Arseneau