Skip to content

Markdown fails to be interpreted after #[doc] attribute is used #42760

Closed
@SergioBenitez

Description

@SergioBenitez

Consider the following structure with documentation:

/// Item docs.
///
#[doc="Hello there!"]
///
/// # Example
///
/// ```rust
/// // some code here
/// ```
pub struct NonGen;

At present, rustdoc will render this as:

Item docs.

Hello there!

# Example

// some code here

When the following is expected:

Item docs.

Hello there!

Example

// some code here

In short, after a #[doc] attribute, a markdown header is not interpreted as markdown.

This also applies to headers declared using ===, where

Example
=======

is rendered by rustdoc as:

Example =======

as opposed to the expected:

Example

I wouldn't be surprised if this is a more systemic issue and additional markdown syntax is interpreted literally as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.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