What are possible ways of adding table of contents in html output of knitr::knit2html()?
I am familiar with the markdownHTMLOptions solution. However the result is not the good-looking one? For me it is important to have such table of contents so that it follows the webpage while scrolling and i could possibly navigate anytime I want.
A floating table of contents is now supported by Rmarkdown! It moves with you as you scroll, you click to navigate... such an improvement :)
The directions are very good: http://rmarkdown.rstudio.com/html_document_format.html
In short, add this at the top of your rmd script, where toc stands for table of contents, and float means that it stays visible on the left as the page scrolls:
---
title: "Bla"
output:
html_document:
toc: true
toc_float: true
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With