Skip to content

rustdoc does not consistently apply syntax highlighting to the item declaration #117555

Closed
@Wilfred

Description

@Wilfred

There doesn't seem to be keyword or comment highlighting for the first snippet on rustdoc pages.

https://doc.rust-lang.org/std/path/struct.PathBuf.html

Screenshot 2023-11-03 at 11 28 28

https://doc.rust-lang.org/std/default/trait.Default.html (there is some highlighting here, but less than other snippets)

Screenshot 2023-11-03 at 11 29 00

By contrast, other snippets seem to be fine, e.g. https://doc.rust-lang.org/std/vec/struct.Vec.html#examples has keyword and comment highlighting:

Screenshot 2023-11-03 at 11 30 49

I searched for rustdoc syntax highlighting issues, but I couldn't find anything relevant. #75981 notes that rustdoc is using the lexer to highlight, but I'd expect that to handle at least comments correctly. This issue seems to have existed for a while, e.g. #103050 shows the same missing comment highlighting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)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