I am using R Studio to create a markdown document. I tried:
Jump to [Header 1](#anchor)
I would like
Here is a solution for HTML documents using jQuery:
---
title: "Internal Links"
output: html_document
---
# First Section
## Second Section
### Third Section
Go to first section
Go to second section
Go to third section
As the comments point out, we simply select all headers, read out their content (e.g. "First Section") and add the attribute id
with the value corresponding to the specific content to each header.
Now you can link to any header using #HEADER
(e.g. #First Section
).
This is of course extendable to all other elements you wish to put an anchor on. So if you want to link to any of your chunks, simply add this script to your document:
Now you can link to the chunks by using My Chunk
where i
goes from 0, the first chunk, to N
, the very last chunk in your document.