Skip to content

rustdoc: force pre tags to have the default line height #105912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ code, pre, a.test-arrow, .code-header {
}
pre {
padding: 14px;
line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
}
.item-decl pre {
overflow-x: auto;
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/codeblock-sub.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Test that code blocks nested within <sub> do not have a line height of 0.
goto: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"

store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight")
assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| })
19 changes: 19 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,22 @@ impl TypeWithImplDoc {
/// fn doc
pub fn test_fn() {}
}

/// <sub id="codeblock-sub-1">
///
/// ```
/// one
/// ```
///
/// </sub>
///
/// <sub id="codeblock-sub-3">
///
/// ```
/// one
/// two
/// three
/// ```
///
/// </sub>
pub mod codeblock_sub {}