]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: force pre tags to have the default line height
authorMichael Howell <michael@notriddle.com>
Mon, 19 Dec 2022 17:18:10 +0000 (10:18 -0700)
committerMichael Howell <michael@notriddle.com>
Mon, 19 Dec 2022 17:23:46 +0000 (10:23 -0700)
Fixes #105906

src/librustdoc/html/static/css/rustdoc.css
src/test/rustdoc-gui/codeblock-sub.goml [new file with mode: 0644]
src/test/rustdoc-gui/src/test_docs/lib.rs

index 022ed606cc3b8b96718361ef59effac37de2fe56..d392cc5ad5df288b5a32ad9210796bd8a69cdd55 100644 (file)
@@ -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 (file)
index 0000000..cbd314d
--- /dev/null
@@ -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| })
index f1b69d4dc1d40ba174e47ff29422f24033ce7279..51250439694b054d85f3c85110ac67ac3692a5da 100644 (file)
@@ -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 {}