Skip to content

Anchors in intra doc link #62833

@dtolnay

Description

@dtolnay
Member

lib.rs:

/// A!
///
/// # Errors
///
/// None?
pub struct A;

/// [x][A], [y][A#errors], [z]
///
/// [z]: A#errors
pub struct B;

The documentation of B is rendered by rustdoc as ` x, [y][A#errors], z `, in which the x link correctly points to the documentation of A as expected, the y link is unrendered, and the z link points to href="A#errors".

I would expect both y and z to have href="struct.A.html#errors".

Mentioning the tracking issue: #43466

Activity

added
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by name
on Jul 20, 2019
dtolnay

dtolnay commented on Jul 20, 2019

@dtolnay
MemberAuthor

Importantly, this should take into account the deduplication of anchors on the same page. In the following, [A#errors] should go to struct.A.html#errors and [A::f#errors] should go to struct.A.html#errors-1 (which is how the anchor is deduplicated today).

/// A!
///
/// # Errors
///
/// None?
pub struct A;

impl A {
    /// f!
    ///
    /// # Errors
    ///
    /// Also none.
    pub fn f() {}
}

/// [A#errors], [A::f#errors]
pub struct B;
added a commit that references this issue on Nov 27, 2019
b5f265e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameC-bugCategory: This is a bug.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

    Participants

    @jonas-schievink@dtolnay@GuillaumeGomez

    Issue actions

      Anchors in intra doc link · Issue #62833 · rust-lang/rust