diff options
| author | Michael Howell <michael@notriddle.com> | 2022-12-19 10:18:10 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-12-19 10:23:46 -0700 |
| commit | f24c04c3f8f4ac0ef318fa1c415aded1f781ebdf (patch) | |
| tree | 2e32673d2c649de4143a197bd2f13952e2bc79dd | |
| parent | 4653c93e4442d88bf3278067183c8fdc0be74a1f (diff) | |
| download | rust-f24c04c3f8f4ac0ef318fa1c415aded1f781ebdf.tar.gz rust-f24c04c3f8f4ac0ef318fa1c415aded1f781ebdf.zip | |
rustdoc: force pre tags to have the default line height
Fixes #105906
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 1 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/codeblock-sub.goml | 5 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src/test_docs/lib.rs | 19 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 022ed606cc3..d392cc5ad5d 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 00000000000..cbd314d2791 --- /dev/null +++ b/src/test/rustdoc-gui/codeblock-sub.goml @@ -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| }) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index f1b69d4dc1d..51250439694 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() {} } + +/// <sub id="codeblock-sub-1"> +/// +/// ``` +/// one +/// ``` +/// +/// </sub> +/// +/// <sub id="codeblock-sub-3"> +/// +/// ``` +/// one +/// two +/// three +/// ``` +/// +/// </sub> +pub mod codeblock_sub {} |
