Skip to content

rustdoc: make linking to examples easier and detect dead links #130493

Description

@alice-i-cecile

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 bevyengine/bevy#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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions