-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Open
Labels
A-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Description
Consider the following code:
//! Top-level documentation.
//!
//! ```rust
//! // ... some Rust code ...
//!
//! # // ... hidden boilerplate-y Rust code ...
//!
//! // ... some Rust code ...
//! ```
Currently (last checked: 2024), rustdoc renders two empty lines in between the first & the last comment (quite reasonably so). However, it might be nice to essentially collapse them into a single line since the author likely didn't intend to have extra lines in the rendered output but only in the source code for legibility (since there the #
-prefixed code is obviously visible).
The "workaround" / user fix for this is to manually hide the "blank" lines with #
:
//! Top-level documentation.
//!
//! ```rust
//! // ... some Rust code ...
//! #
//! # // ... hidden boilerplate-y Rust code ...
//!
//! // ... some Rust code ...
//! ```
An argument could be made that this is less "esthetically pleasing" and a bit annoying.
Original issue description from 2018 for context
Basically, I want:
rust code
# secret boilerplatey rust code
more rust code
to render the same as:
rust code
#
# secret boilerplatey rust code
more rust code
Metadata
Metadata
Assignees
Labels
A-rustdoc-uiArea: Rustdoc UI (generated HTML)Area: Rustdoc UI (generated HTML)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.