Skip to content

fix: pretty url toc highlighting#3028

Merged
ehuss merged 2 commits into
rust-lang:masterfrom
bens-schreiber:schreiber/fix-pretty-urls
May 19, 2026
Merged

fix: pretty url toc highlighting#3028
ehuss merged 2 commits into
rust-lang:masterfrom
bens-schreiber:schreiber/fix-pretty-urls

Conversation

@bens-schreiber
Copy link
Copy Markdown
Contributor

@bens-schreiber bens-schreiber commented Feb 9, 2026

This fix compares the current page to the active page, ignoring the .html suffix.

fixes #3034

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Feb 9, 2026
@jhult
Copy link
Copy Markdown
Contributor

jhult commented Mar 8, 2026

Related PRs: #3038, #2993, #2570

@dv1x3r
Copy link
Copy Markdown

dv1x3r commented Mar 30, 2026

Thank you! As a workaround, it is also possible to apply this patch using the Makefile command:

.PHONY: docs
docs:
	mdbook build docs/
	find docs/book -name 'toc*.js' -print0 | xargs -0 sed -i 's@if (link.href === current_page@if (link.href.replace(/\.html$$/, "") === current_page.replace(/\.html$$/, "")@g'

Copy link
Copy Markdown
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

(Normally we would require tests for changes, but this is somewhat tricky to test since it would require a server that does the corresponding redirects. I'm fine with skipping that for now.)

View changes since this review

@ehuss ehuss added this pull request to the merge queue May 19, 2026
Merged via the queue into rust-lang:master with commit 4f5b487 May 19, 2026
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label May 19, 2026
@bens-schreiber bens-schreiber deleted the schreiber/fix-pretty-urls branch May 20, 2026 02:44
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

Successfully merging this pull request may close these issues.

TOC highlighting breaks on prettified URLs

5 participants