Skip to content

Add per page TOC in the rustc book #140113

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Apr 21, 2025

This PR adds per page Table of Content (TOC) in the rustc book (to be extended in the future to our other books).

The goal is to easy the navigation inside the page by providing quick overview of the page content and our position inside that page.

That functionality is unfortunately not available natively in mdbook, which prompted community members to create mdBook-pagetoc (which this PR is heavily inspired by). It's "only" a JS file (to handle the TOC) and a CSS file (to handle the margin, colors, screen size, ...), there is no "post-processor" needed (in mdbook sense).

image

Live preview at: http://urgau.rf.gd/book

r? @jieyouxu

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 21, 2025
@Urgau Urgau force-pushed the rustc-book-page-toc branch from 988a34a to b266992 Compare April 21, 2025 12:53
@@ -0,0 +1,104 @@
/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/ */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidtwco @wesleywiser, legal question here, pagetoc.css and pagetoc.js are both heavily inspired by https://github.com/JorelAli/mdBook-pagetoc/ which is licensed under the "WTFPL" license (Do What The F*ck You Want To Public License).

Is it okay for us to re-license those files under our dual license MIT/Apache-2?

@jieyouxu
Copy link
Member

cc @ehuss

@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants