I am using RStudio 1.1.463 on macOS 10.13.6 (17G65).
I have tried the syntax on this post
title: "R Notebook"
output:
html_document:
toc: true
theme: united
df_print: paged
code_folding: hide
but the toc didn't show up.
adding css as follow
html_notebook:
css: /.../.../my.css
causes error
pandoc: Could not fetch /.../.../my.css
/.../.../my.css: openBinaryFile: does not exist (No such file or directory)
How to add table of contents in R notebook?
I think you need to align yaml part properly.
I tried the following, and it works.
---
title: "R Notebook"
output:
html_notebook:
toc: yes
---
# first level 1 heading
bla bla bla
# second level 1 heading
## first level 2 heading under second level 1 heading
bla bla bla
## second level 2 heading under second level 1 heading
bla bla bla
This generates the following:
your screenshot imply this paged is generated by Knit, so this html is NOT generated automatically. every time you want to preview, you need to generate this manually by clicking Knit. is it?
it is weird. if i don't include toc: true, each time i refresh the .nb.html, the change i made in rmd file get synched. if i include toc: true, the nb.html does not change anymore, i have to Knit it manually. what i am missing?
I just restarted, everything is going back to work, thank u so much!
with Yarnabrina help, I finally found the root cause -- i misused html_document rather than html_notebook.
html_notebook works well.