Skip to content

Subpages links doesn't work #1268

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

Closed
Kiblyn11 opened this issue Jul 1, 2020 · 9 comments · May be fixed by #1316
Closed

Subpages links doesn't work #1268

Kiblyn11 opened this issue Jul 1, 2020 · 9 comments · May be fixed by #1316
Labels
A-Links Area: Issues with links A-Summary Area: The summary page, organization of pages.

Comments

@Kiblyn11
Copy link

Kiblyn11 commented Jul 1, 2020

I'm not sure how this should work but I cannot make links works in subpages.

Here my structure:

- SUMMARY.md
- folder1
  - README.md
  - folder2
    - README.md
    - stuff.md
  - folder3
    - README.md
    - stuff.md

Summary is OK and links works:

# Summary

- [folder1](./folder1/README.md)
  - [folder2](./folder1/folder2/README.md)
  - [folder3](./folder1/folder3/README.md)

But folder1/README.md links doesnt work

# folder1

- [folder2](./folder2/README.md)
- [folder3](./folder3/README.md)

I get 404 Document not found when clicking on these in the folder1 page.
It tries to access http://localhost:3000/folder1/folder2/README.html instead of http://localhost:3000/folder1/folder2/index.html (according to the link of the main page)

@ehuss
Copy link
Contributor

ehuss commented Jul 1, 2020

All files named README.md are converted to index.md. The documentation for this is pretty hidden (https://rust-lang.github.io/mdBook/format/config.html?highlight=readme#configuring-preprocessors), it should probably be added to the SUMMARY documentation. It might also be possible to catch that mistake as a warning, though I'm not sure how hard that would be.

@ehuss ehuss added A-Links Area: Issues with links A-Summary Area: The summary page, organization of pages. labels Jul 1, 2020
@Kiblyn11
Copy link
Author

Kiblyn11 commented Jul 3, 2020

Ok thanks!

@kssmilik
Copy link

Adding this piece to the book.toml config solved this issue to me.

[build]
use-default-preprocessors = false

[preprocessor.links]

@xileftenurb
Copy link

It work because you desactivate

[preprocessor.index]

who rename all README.md file into index.html

It seems the index preprocessor change the link in SUMMARY.md but not those in the rest of the book.

It look like a bug to me.

@xileftenurb
Copy link

Also, this is a duplicate of #984

@xileftenurb
Copy link

The problem is that there is no logic to change the path in file other than SUMMARY.md in the preprocessor.
the processor is defined here and is pretty simple :
https://github.com/rust-lang/mdBook/blob/master/src/preprocess/index.rs

check the path, if it's match "README.md", rename the file to "index.md" and change the path to "index.md"

To rename all link, the preprocessor should open all file (README or not), search for path who point to README, and changed them to index.md`
I don't know rust well enough to do it myself, sadly.

@Progdrasil
Copy link

This is blocked by the issue in pulldown-cmark pulldown-cmark/pulldown-cmark#423

@shonfeder
Copy link

Looks like pulldown-cmark/pulldown-cmark#423 has been resolved 🎉 :)

We'd love to see this fixed. 🙏

@ehuss
Copy link
Contributor

ehuss commented Jul 26, 2021

Closing as a duplicate of #984. Feel free to leave more comments over there.

@ehuss ehuss closed this as completed Jul 26, 2021
Roms1383 added a commit to Roms1383/flutter_rust_bridge that referenced this issue Sep 24, 2022
this is required at the moment to have sublinked markdown being generated in html

see issue rust-lang/mdBook#1268
Roms1383 added a commit to Roms1383/flutter_rust_bridge that referenced this issue Sep 26, 2022
this is required at the moment to have sublinked markdown being generated in html

see issue rust-lang/mdBook#1268
onkoe added a commit to Sooner-Rover-Team/soro-documentation that referenced this issue May 28, 2023
First, this should run through Actions reeeeeal fast. But also...
I think this is a widespread issue, unfortunately:
rust-lang/mdBook#1268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Links Area: Issues with links A-Summary Area: The summary page, organization of pages.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants