Skip to content

How to show the table of contents#7

Open
yihui wants to merge 2 commits intomasterfrom
feature/show-toc
Open

How to show the table of contents#7
yihui wants to merge 2 commits intomasterfrom
feature/show-toc

Conversation

@yihui
Copy link
Owner

@yihui yihui commented Jun 23, 2017

It depends on whether your post is R Markdown or plain Markdown. For R Markdown, it is easy -- just add this to YAML:

output:
  blogdown::html_page:
    toc: true

Example: https://deploy-preview-7--hugo-xmin.netlify.com/post/2017/06/22/rmd-toc/

For plain Markdown posts, the template single.html has to be modified. For example, we can use a YAML parameter toc to control whether to write out .TableOfContents. Example: https://deploy-preview-7--hugo-xmin.netlify.com/about/

The CSS style was defined in style.css (a lightgray border).

@yihui yihui force-pushed the feature/show-toc branch from 4e1ddbf to dbe6fca Compare June 30, 2017 02:38
@yihui yihui added the feature label Jun 30, 2017
@yihui yihui force-pushed the feature/show-toc branch 2 times, most recently from cecb021 to be471d6 Compare July 9, 2017 17:46
@yihui yihui force-pushed the feature/show-toc branch 2 times, most recently from 132bf32 to b47be96 Compare July 13, 2017 07:08
@yihui yihui force-pushed the feature/show-toc branch from b47be96 to de81e09 Compare August 14, 2017 20:28
@yihui yihui force-pushed the feature/show-toc branch from de81e09 to 85a341d Compare August 29, 2017 03:02
@yihui yihui force-pushed the feature/show-toc branch from 85a341d to 3e341a9 Compare October 8, 2017 14:24
@yihui yihui force-pushed the feature/show-toc branch from 429663d to 858eb50 Compare March 21, 2018 15:39
@yihui yihui force-pushed the feature/show-toc branch from 858eb50 to 1a94e25 Compare August 30, 2018 15:02
@yihui yihui force-pushed the feature/show-toc branch from 1a94e25 to c47f304 Compare October 1, 2018 14:33
@enersto
Copy link

enersto commented Feb 1, 2019

So there is still no toc_float for html_page?

@yihui yihui force-pushed the feature/show-toc branch from c47f304 to d940844 Compare March 20, 2019 02:59
@yihui yihui force-pushed the feature/show-toc branch from d940844 to 3b9ba36 Compare April 18, 2019 19:01
@yihui yihui force-pushed the feature/show-toc branch from 3b9ba36 to 0b814ed Compare March 17, 2020 03:07
@yihui yihui force-pushed the feature/show-toc branch from 0b814ed to f43a399 Compare July 24, 2020 19:48
@yihui yihui force-pushed the feature/show-toc branch 2 times, most recently from c5cd722 to 7c8d7c3 Compare October 11, 2020 20:57
@yihui yihui force-pushed the feature/show-toc branch from 7c8d7c3 to c77e803 Compare June 15, 2022 03:53
@yihui yihui force-pushed the feature/show-toc branch from b1927ae to 91762e7 Compare March 4, 2024 02:24
@phnaharris
Copy link

Hi,

Just wondering if there’s any reason this hasn’t been merged into the master branch yet. I’m really looking forward to using this feature, but keeping it maintained downstream has been a bit inconvenient. I think it would be great to have it supported out of the box upstream.

Thanks a lot for your work on this theme — really appreciate it.. Happy coding.

@yihui
Copy link
Owner Author

yihui commented Dec 15, 2025

@phnaharris The reason is here: https://yihui.org/en/2017/09/pull-requests-as-a-teaching-tool/ These PRs are often simple enough and I'll leave them to you to merge by yourself. Thanks for the nice words!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants