'Use internal links in RMarkdown HTML output
I am using R Studio to create a Rmarkdown (.Rmd) document. I tried:
Jump to [Header 1](#anchor)
I would like to set up a link so when a reader clicks it, they jump to a specific point on the page.
Let's say the point I want them to be directed to has a header "## Test".
Solution 1:[1]
Pandoc supports explicit and implicit section references for headers; see the pandoc manual.
- explicit: you give a custom name to a header
## Test {#test}and later refer to it with a link syntax:see [the relevant section](#test). - implicit: headers where you don't set a custom name, like
## Test, can still be refered to:See the section called [Test].
Both syntax should allow you to click on the link to go to the anchor, and should work in most output format. (only tested with html and pdf).
---
output: pdf_document
---
## A section
blah blah
## A second section with a custom identifier {#custom}
blah blah
## Links
You can use implicit references to refer to sections
you have not explicitly named, like this:
see [A section].
You can use links to refere to sections with explicit
references, like this: see [the second section](#custom).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
