Avoid creating automatic hyperlinks with knitr, markdown

knitr

automatically creates links when knitting .Rmd to .html. This is very often useful, but right now it is not what I want.

Let's assume you have this .Rmd file:

---
title: "Doc title"
output: html_document
---

I don't want this@to-be-a-link.com, but it comes out that way. 

If you wrap it in an R expression  `r "this@is-still-a-link.com"`.

Is there some kind of CSS trick I can avail myself of if I wanted <style='nolink'>www.something.com</style> not to be a link?

      

Knitting:

library(knitr)
knit2html('that_file.Rmd', 'that_file.html')

      

results in all of these links being links.

enter image description here

Is there an easy way to generally maintain automatic link generation, but selectively disable it on certain lines? Thanks for any thoughts.

Edit: I guess I should have tried the solution below first before accepting. It's in .Rmd

I don't want this <!-- breaklink -->@to-be-a-link.com

      

... doesn't actually parse the HTML comment because - changes to em dash (by knitr? pandoc?) and then I get:

enter image description here

+3


source to share


1 answer


The two options I see are (1) using naked backlinks, or (2) "breaking" the link with an empty HTML comment.

Example:

---
title: "Doc title"
output: html_document
---

I don't want this<!-- -->@to-be-a-link.com, but it comes out that way. 

If you wrap it in an R expression `this@is-still-a-link.com`.

Is there some kind of CSS trick I can avail myself of if I wanted 
<style='nolink'>http<!-- -->://www.something.com</style> not to 
be a link?

      



becomes:

enter image description here

+4


source







All Articles