Support percent-encoded chapter paths#3162
Open
ychampion wants to merge 1 commit into
Open
Conversation
Decode valid UTF-8 escapes for source lookup, then encode generated chapter URL surfaces so path delimiters remain filename characters. Constraint: Chapter filenames may contain URL delimiters that must be decoded for disk access and re-encoded in generated links. Rejected: Decode without renderer encoding | would turn question marks and hashes into URL delimiters. Confidence: high Scope-risk: moderate Directive: Keep filesystem paths decoded internally and encode only generated chapter URL surfaces. Tested: summary/html crate suites with and without defaults; targeted TOC regression in both feature modes; workspace packages; 109/111 root tests; strict Clippy; rustdoc; rustfmt; guide build; CLI reproduction Not-tested: Native Windows filesystem behavior for question-mark filenames; two nested-Cargo harness cases blocked by the external target location
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.
Summary
Why
SUMMARY.mdonly decoded%20, so a path such asquestion%3F.mdcould not loadquestion?.md. Emitting the decoded path unchanged would also turn?and#filename characters into URL delimiters.Closes #1640.
Validation
cargo test -p mdbook-summary -p mdbook-html— passedcargo test --test testsuite toc::percent_encoded_chapter_paths -- --exact— passedcargo test --test testsuite toc::percent_encoded_chapter_paths --no-default-features -- --exact— passedcargo clippy --workspace --all-targets --no-deps -- -D warnings— passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --document-private-items --no-deps— passedcargo fmt --all --check— passed