Skip to content
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

Markdown page table of contents #1263

Open
JorelAli opened this issue Jun 23, 2020 · 5 comments
Open

Markdown page table of contents #1263

JorelAli opened this issue Jun 23, 2020 · 5 comments

Comments

@JorelAli
Copy link

Expanding from the idea of @ishitatsuyuki, I think mdbook should have the option to have a right-hand sidebar with a table of contents for a page.

Screenshot example

image

Examples of similar documents:

This could be implemented as an option in the book.toml file, or could be a YAML front matter setting at the top of a page, such as:

---
toc: true
---

Page content here...
@JorelAli
Copy link
Author

For anyone still reading this (@aidan-fitz @tshepang @maniyar1), I've made a temporary workaround here.

@Sebas-h
Copy link

Sebas-h commented Oct 28, 2021

Thanks @JorelAli 👍

I've used the CSS/JS you wrote and put it in a Userscript here (to be run by the browser).
This way we can have a page ToC on deployed mdBooks that do not have one yet.

Hopefully this is somewhat useful :)

@Evian-Zhang
Copy link
Contributor

Come across this issue when I tried to find a solution for in-page tocs. This is such a great job and I wonder why not file a PR to merge this into mdbook's main stream so that everyone can use this feature out-of-box?

@Leroy-X
Copy link

Leroy-X commented Sep 21, 2023

wow, this is exactly what I need, I spent a lot of time looking for it,
I really look forward to merging it into mdbook soon. Pleeeeeaaaaase!!! It will save users a lot of time out of the box.
Big thanks!!!

@2bndy5
Copy link

2bndy5 commented Aug 26, 2024

It would be nice if the solution to this didn't involve JS because that just offloads the needed changes in mdbooks source to end-users (doc readers) on page load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants