I love floating TOCs in my Rmarkdown and prettydoc package but trying to use both seems impossible.
I just want to add a floating TOC to my HTML Pretty doc. This is my working yaml header
title: "testing TOCs"
author: "Joe"
output:
prettydoc::html_pretty:
theme: leonids
highlight: github
toc: true
Adding Floating TOC option issues an error message asking for Theme.
title: "Test floating TOC"
author: "joe"
output:
prettydoc::html_pretty:
theme: leonids
highlight: github
toc: true
toc_float: true
Error in rmarkdown::html_document(fig_retina = fig_retina, css = NULL, :
You must use a theme when specifying the 'toc_float' option
Calls: <Anonymous> ... do.call -> <Anonymous> -> <Anonymous> -> <Anonymous>
Its usage is extremely easy: simply replace the rmarkdown::html_document or rmarkdown::html_vignette output engine by prettydoc::html_pretty in your R Markdown header, and use one of the built-in themes and syntax highlighters. For example
Also note that you have a comment within in your rmarkdown file, which will be interpreted as a header: The answer doesn't seem to work for me: There is only a floating toc, no toc at the beginning of the html. Also you'd need to watch the indent in the yaml: toc_depth and number_sections needs to be indented.
So can we do BOTH, a lightweight yet nice-looking theme for R Markdown? The answer is YES! (At least towards that direction) The prettydoc package provides an alternative engine, html_pretty , to knit your R Markdown document into pretty HTML pages.
The prettydoc package provides an alternative engine, html_pretty , to knit your R Markdown document into pretty HTML pages.
Per GitHub documentation, toc_float does not work with prettydoc.
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