]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: apply `pre-wrap` CSS to code-wrapped links
authorMichael Howell <michael@notriddle.com>
Tue, 13 Dec 2022 17:46:27 +0000 (10:46 -0700)
committerMichael Howell <michael@notriddle.com>
Tue, 13 Dec 2022 17:48:40 +0000 (10:48 -0700)
This is common syntax used for intra-doc links, so fixing it should help
with doc formatting.

src/librustdoc/html/static/css/rustdoc.css
src/test/rustdoc-gui/docblock-big-code-mobile.goml
src/test/rustdoc-gui/src/test_docs/lib.rs

index d22d2f2edb038ba6c2d8b13322beccb039fe51bd..572a5b42c7f33160783ce66a2cfbb81ae33a4fde 100644 (file)
@@ -585,8 +585,8 @@ ul.block, .block li {
        text-overflow: ellipsis;
 }
 /* Wrap non-pre code blocks (`text`) but not (```text```). */
-.docblock :not(pre) > code,
-.docblock-short code {
+.docblock :not(pre) > code,
+.docblock-short code {
        white-space: pre-wrap;
 }
 
index 9f8df44d762ce5f9402b144b6af81320dfec3b1e..3ce921c2c91cb1a3de4aef659a576085852ca4c7 100644 (file)
@@ -7,3 +7,7 @@ show-text: true // We need to enable text draw to be able to have the "real" siz
 // Little explanations for this test: if the text wasn't displayed on two lines, it would take
 // around 20px (which is the font size).
 assert-property: (".docblock p > code", {"offsetHeight": "44"})
+
+// Same check, but where the long code block is also a link
+goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html"
+assert-property: (".docblock p > a > code", {"offsetHeight": "44"})
index d6eeab803dfec3c7e9399be5f87f4cb3ba903b54..f55b9ec3af515235d7a34617afcdf604af10daff 100644 (file)
@@ -154,6 +154,11 @@ pub mod huge_amount_of_consts {
 /// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
 pub mod long_code_block {}
 
+/// Very long code text [`hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`][lnk].
+///
+/// [lnk]: crate::long_code_block_link
+pub mod long_code_block_link {}
+
 #[macro_export]
 macro_rules! repro {
     () => {};