Closed
Description
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
https://doc.rust-lang.org/std/default/trait.Default.html (there is some highlighting here, but less than other snippets)
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:
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.
Activity
[-]rustdoc does not apply full syntax highlighting to the first code snippet[/-][+]rustdoc does not apply full syntax highlighting to the item declaration[/+][-]rustdoc does not apply full syntax highlighting to the item declaration[/-][+]rustdoc does not consistently apply syntax highlighting to the item declaration[/+]GuillaumeGomez commentedon Nov 6, 2023
It's true that
pub
andstruct
should be highlighted. I'll send a fix shortly.GuillaumeGomez commentedon Nov 6, 2023
I opened #117643, but as mentioned in the PR, I'm really not sure this is a good idea. You can test the feature there.
Rollup merge of rust-lang#117869 - GuillaumeGomez:comment-highlightin…
Unrolled build for rust-lang#117869