Skip to content

fix(links): support spaces in #include file paths - #3163

Open
l46983284-cpu wants to merge 1 commit into
rust-lang:masterfrom
l46983284-cpu:fix/include-path-spaces-2812
Open

fix(links): support spaces in #include file paths#3163
l46983284-cpu wants to merge 1 commit into
rust-lang:masterfrom
l46983284-cpu:fix/include-path-spaces-2812

Conversation

@l46983284-cpu

Copy link
Copy Markdown

Summary

{{#include}} and {{#rustdoc_include}} now use the full captured path instead of splitting on whitespace, so file names and paths may contain spaces (for example {{#include fila a.md}}). Line ranges still work ({{#include fila a.md:1:2}}).

Playground links are unchanged and still use whitespace-separated path and properties.

Fixes #2812.

Test plan

  • Unit tests in links.rs for paths with spaces (with and without line ranges)
  • Extended includes/all_includes testsuite case
  • cargo test -p mdbook-driver --lib builtin_preprocessors::links::tests
  • cargo test -p mdbook --test testsuite includes::include
  • cargo fmt --all and cargo clippy -p mdbook-driver --lib --no-deps -- -D warnings
  • CI

Parse the full include/rustdoc_include target instead of splitting on
whitespace, so paths like `fila a.md` work. Line ranges still work
(`fila a.md:1:2`). Playground links keep whitespace-separated properties.

Fixes rust-lang#2812.

Signed-off-by: Alex Chen <l46983284@gmail.com>
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#include fails with a space in the file name

2 participants