How to make pandoc not create the <a> tag when the URL in the YAML metadata

Say we have a simple empty .Rmd file with YAML metadata like this

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

Then in the html template it will automatically appear in the <a> tag

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

How to make pandoc not build <a> when there is a URL in YAML? I mean, I want to finally get the plan text in the html template

 http://google.com 

Or, if I use my own html template, I can add the link this way

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

Thanks for the help!

+5
source share
2 answers

This is caused by the extension, which is enabled by default with the md_extensions option in the output format, in particular 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 --- 

Please note that this will affect the automatic binding of URIs on your document, not only in the header. After disabling the extension, you will need to enclose the links in angle brackets to create links, i.e. <https://www.google.com> . The Pandoc and R Markdown website contain details about this.

+2
source

Replacing the character in the header with an ASCII HTML link will stop the link from automatically generating and displaying correctly on the page. For example, here I replace the colon:

 --- title: https&#58;//gooogle.com --- 
+1
source

Source: https://habr.com/ru/post/1273103/


All Articles