diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 022ed606cc3b8..d392cc5ad5df2 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -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; diff --git a/src/test/rustdoc-gui/codeblock-sub.goml b/src/test/rustdoc-gui/codeblock-sub.goml new file mode 100644 index 0000000000000..cbd314d27915e --- /dev/null +++ b/src/test/rustdoc-gui/codeblock-sub.goml @@ -0,0 +1,5 @@ +// Test that code blocks nested within 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| }) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index f1b69d4dc1d40..51250439694b0 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -455,3 +455,22 @@ impl TypeWithImplDoc { /// fn doc pub fn test_fn() {} } + +/// +/// +/// ``` +/// one +/// ``` +/// +/// +/// +/// +/// +/// ``` +/// one +/// two +/// three +/// ``` +/// +/// +pub mod codeblock_sub {}