Add per page TOC in the rustc book#140113
Merged
bors merged 3 commits intorust-lang:masterfrom May 18, 2025
Merged
Conversation
988a34a to
b266992
Compare
Urgau
commented
Apr 21, 2025
Member
|
cc @ehuss |
jieyouxu
approved these changes
Apr 22, 2025
Member
jieyouxu
left a comment
There was a problem hiding this comment.
I did play with the prototype quite a bit, and the per-page TOC looks very nice there to me (I tried various screen sizes and all the themes). I'll hand this review over to Eric who might have more clues about the book itself.
Member
|
r? @ehuss (in case you have any concerns about the extra js/css of the book itself) |
6df24a0 to
4cbcb44
Compare
wesleywiser
approved these changes
May 17, 2025
Member
wesleywiser
left a comment
There was a problem hiding this comment.
lgtm unless @ehuss has concerns
Contributor
|
Thanks! A minor thing I noticed is that the colors don't work very well with the Rust theme, but that is not a blocker. @bors r+ rollup |
Collaborator
fmease
added a commit
to fmease/rust
that referenced
this pull request
May 18, 2025
Add per page TOC in the `rustc` book 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](https://github.com/JorelAli/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).  Live preview at: http://urgau.rf.gd/book r? `@jieyouxu`
fmease
added a commit
to fmease/rust
that referenced
this pull request
May 18, 2025
Add per page TOC in the `rustc` book 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](https://github.com/JorelAli/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).  Live preview at: http://urgau.rf.gd/book r? ``@jieyouxu``
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 18, 2025
Rollup of 7 pull requests Successful merges: - rust-lang#140113 (Add per page TOC in the `rustc` book) - rust-lang#140490 (split `asm!` parsing and validation) - rust-lang#140924 (Make some `f32`/`f64` tests also run in const-context) - rust-lang#141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test) - rust-lang#141071 (Enable [behind-upstream] triagebot option for rust-lang/rust) - rust-lang#141132 (Use `crate::` prefix for root macro suggestions) - rust-lang#141139 (Fix Rust for Linux ping group label) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 18, 2025
Rollup of 8 pull requests Successful merges: - rust-lang#140113 (Add per page TOC in the `rustc` book) - rust-lang#140511 (Stabilize `#![feature(non_null_from_ref)]`) - rust-lang#140924 (Make some `f32`/`f64` tests also run in const-context) - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc) - rust-lang#141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test) - rust-lang#141071 (Enable [behind-upstream] triagebot option for rust-lang/rust) - rust-lang#141132 (Use `crate::` prefix for root macro suggestions) - rust-lang#141139 (Fix Rust for Linux ping group label) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 18, 2025
Rollup merge of rust-lang#140113 - Urgau:rustc-book-page-toc, r=ehuss Add per page TOC in the `rustc` book 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](https://github.com/JorelAli/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).  Live preview at: http://urgau.rf.gd/book r? ```@jieyouxu```
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
May 20, 2025
Fix pagetoc inactive color in rustc book This PR fixes the color of inactive entry in rustc pagetoc, particularly with the "Rust" theme. | Before | After | |--------|-------| |  |  | Live preview at: http://urgau.rf.gd/book Related to rust-lang#140113 (comment) r? `@ehuss`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 21, 2025
Rollup merge of rust-lang#141303 - Urgau:pagetoc-fix-color, r=ehuss Fix pagetoc inactive color in rustc book This PR fixes the color of inactive entry in rustc pagetoc, particularly with the "Rust" theme. | Before | After | |--------|-------| |  |  | Live preview at: http://urgau.rf.gd/book Related to rust-lang#140113 (comment) r? `@ehuss`
weihanglo
added a commit
to weihanglo/cargo
that referenced
this pull request
Aug 17, 2025
We've already saw rustc and rustc-dev-guide adopting this. Since The Cargo Book is more like a reference manual, so would largely benefit from the toc on page. Ref: <rust-lang/rust#140113>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds per page Table of Content (TOC) in the
rustcbook (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).Live preview at: http://urgau.rf.gd/book
r? @jieyouxu