Skip to content

rename README.md to index.md, to avoid broken link alerts #901

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

tshepang
Copy link
Member

@tshepang tshepang commented Jun 15, 2025

mdbook renders README.md files as index.html, so linking to README.md results in 404 errors.

Rendered

@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 15, 2025
@apiraino
Copy link
Contributor

apiraino commented Jun 15, 2025

Can you show an example of broken link alert?

@tshepang
Copy link
Member Author

tshepang commented Jun 17, 2025

I got it locally when I tried linking to one of the README.md files, so I did not submit the change as a result, and instead made this change

@apiraino
Copy link
Contributor

I got it locally when I tried linking to one the README.md files

I'm sorry, I still don't understand the issue you've found. What kind of linking are you referring to? Between Markdown files? Can you guide me with a concrete step-by-step example?

Thanks

@jieyouxu
Copy link
Member

I feel like this is an mdbook configuration issue 🤔

@jieyouxu
Copy link
Member

jieyouxu commented Jun 17, 2025

EDIT: https://rust-lang.github.io/mdBook/format/configuration/preprocessors.html#configuring-preprocessors

EDIT 2: Wait, is this actually the linkchecker's problem?

@ehuss
Copy link
Contributor

ehuss commented Jun 17, 2025

This is an issue in mdbook (rust-lang/mdBook#984). It automatically converts pages called README.md to index.html. However, it does not convert links to pages like [foo](README.md) to index.html, and thus those links don't work.

There are two workarounds, one is to rename files to index.md, or the other is to link to index.md in the source. I'm not sure which is the most reasonable here.

@apiraino
Copy link
Contributor

This is an issue in mdbook (rust-lang/mdBook#984).

Ah yes, that link is really appreciated, now I get it. So, all the linked PRs to that issue indicates that people are renaming files, which imho is a bit ugly (but now I understand the reasoning).

I looked in the mdbook repo and there seems to be a stalled WIP patch, mdBook#1921. @ehuss I didn't look deep into that, do you think that patch goes in the right direction (I've read your review)?

mdbook renders README.md files as index.html,
so linking to README.md results in 404 errors.
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

I think it's more important that links are fixed, renaming seems fine

@jieyouxu jieyouxu merged commit 44b1f45 into rust-lang:master Jun 20, 2025
1 check passed
@tshepang tshepang deleted the tshepang-renames branch June 20, 2025 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants