-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show toc in a rmarkdown file? #58
Comments
Yes. You can add this to the YAML metadata of your Rmd document: output:
blogdown::html_page:
toc: true Full documentation at https://bookdown.org/yihui/blogdown/templates.html#how-to |
EDIT: This is totally working, just I made some poor assumptions. For anyone who finds this in the future, don't render the .Rmd using knitr just use the ---- Previous This ins't working for me. Here is my YAML metadata:
I also tried substituting
I am using hugo version 0.20.7 on ubuntu, Rmarkdown version 1.5 and blogdown version 0.0.6 fwiw. |
Is it possible to add a checkbox in the "new post" addins to add the toc automatically? I find myself google the grammar of this all the time. Besides, will the floating TOC function be added to blogdown any time soon? Thanks Yihui for the nice work. |
@hezhaobin The problem for a checkbox in the New Post addin is that it is hard to tell what it should do in the case of plain Markdown posts (the implementation of TOC is theme-dependent). For the floating TOC, it is also up to the specific Hugo theme. If you are familiar with HTML/CSS/JS, you could implement it by yourself. |
Hi Yihui. I just got my toc to work in a Rmd in
or
but then I saw section 5.3 of https://bookdown.org/yihui/blogdown/rmd-website.html and I guess the folding and following etc stuff is not implemented in blogdown? I guess it's hard because it would have to be done for each theme, no? So I should just go with the standard toc and be damn happy that it works? :) Just in case it's useful, there IS a really nasty hack... not sure if you'll like it or not, you COULD instead of
|
That is correct. It is easy to do the floating TOC well under the Bootstrap framework. It would be hard to do it for arbitrary CSS frameworks. |
When the document is a
.md
file, the table of contents from the file can be extracted via.TableOfContents
. But if the file extension is.rmd
, the toc cannot be extracted. Any suggestions? Thanks.The text was updated successfully, but these errors were encountered: