rustdoc: add link prefix which would allow overwriting explicit links with item links
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Many crates use #![doc = include_str("../README.md")] to reduce doc duplication. Unfortunately, it means that we have provide explicit item links:
This crate provides the [`foobar`] function.
[`foobar`]: https://docs.rs/foobar/latest/foobar/fn.foobar.html
It works fine when README is rendered on GitHub or crates.io, but when docs generated by rustdoc we get external item links, which causes a number of issues (e.g. when docs generated offline).
It would be nice if rustdoc recognized a special link prefix which would allow it to overwrite explicit links with auto-generated item links. For example:
This crate provides the [`foobar`][rustdoc:foobar] function.
[rustdoc:foobar]: https://docs.rs/foobar/latest/foobar/fn.foobar.html
[link][rustdoc:item] would be translated to [link](link-to-item) and [rustdoc::item]: explicit-link would be ignored by rustdoc.
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
No files or tests are named in the issue. Start by tracing rustdoc's handling of explicit Markdown reference links and item-link resolution, then compare the README example with generated rustdoc output. Done means the proposed prefix behavior is specified and covered for both link forms, including offline-generated documentation.
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
- Mostly clear
- Newbie friendliness
- 35/100