Skip to content

Commit f24c04c

Browse files
committed
rustdoc: force pre tags to have the default line height
Fixes #105906
1 parent 4653c93 commit f24c04c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+1
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ code, pre, a.test-arrow, .code-header {
342342
}
343343
pre {
344344
padding: 14px;
345+
line-height: 1.5; /* https://github.com/rust-lang/rust/issues/105906 */
345346
}
346347
.item-decl pre {
347348
overflow-x: auto;
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Test that code blocks nested within <sub> do not have a line height of 0.
2+
goto: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html"
3+
4+
store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight")
5+
assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| })

src/test/rustdoc-gui/src/test_docs/lib.rs

+19
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,22 @@ impl TypeWithImplDoc {
455455
/// fn doc
456456
pub fn test_fn() {}
457457
}
458+
459+
/// <sub id="codeblock-sub-1">
460+
///
461+
/// ```
462+
/// one
463+
/// ```
464+
///
465+
/// </sub>
466+
///
467+
/// <sub id="codeblock-sub-3">
468+
///
469+
/// ```
470+
/// one
471+
/// two
472+
/// three
473+
/// ```
474+
///
475+
/// </sub>
476+
pub mod codeblock_sub {}

0 commit comments

Comments
 (0)