rustdoc: make linking to examples easier and detect dead links
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
When writing module-level or other high-level documentation, I often want to link to our examples to show users how to do something in more detail. See https://github.com/bevyengine/bevy/pull/15056 for an example of this problem.
This is distinct from the automatically generated links to examples, rustdoc-scrape-examples, (which are great!): we want to be able to manually link to specific examples.
@GuillaumeGomez pointed out that this can be done in part using relative paths, e.g. ../../src/custom_loop/custom_loop.rs.html#19. However, this is very fragile: any change to either file breaks the link with no tooling to detect the breakage. This functionality is also undocumented, and could be broken by rustdoc / docs.rs at any time.
To add full support, he thinks we might need an intra-doc link extension to make it work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing rustdoc-scrape-examples behavior and the example described in PR #15056, then examine how the relative-path approach is currently handled. Done means rustdoc provides a documented, stable way to link to specific examples and detects links that no longer resolve.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100