Skip to content

Commit e38d1e9

Browse files
committed
rustdoc: apply pre-wrap CSS to code-wrapped links
This is common syntax used for intra-doc links, so fixing it should help with doc formatting.
1 parent ed620cf commit e38d1e9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ ul.block, .block li {
585585
text-overflow: ellipsis;
586586
}
587587
/* Wrap non-pre code blocks (`text`) but not (```text```). */
588-
.docblock > :not(pre) > code,
589-
.docblock-short > code {
588+
.docblock :not(pre) > code,
589+
.docblock-short code {
590590
white-space: pre-wrap;
591591
}
592592

src/test/rustdoc-gui/docblock-big-code-mobile.goml

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ show-text: true // We need to enable text draw to be able to have the "real" siz
77
// Little explanations for this test: if the text wasn't displayed on two lines, it would take
88
// around 20px (which is the font size).
99
assert-property: (".docblock p > code", {"offsetHeight": "44"})
10+
11+
// Same check, but where the long code block is also a link
12+
goto: "file://" + |DOC_PATH| + "/test_docs/long_code_block_link/index.html"
13+
assert-property: (".docblock p > a > code", {"offsetHeight": "44"})

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

+5
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ pub mod huge_amount_of_consts {
154154
/// Very long code text `hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`.
155155
pub mod long_code_block {}
156156

157+
/// Very long code text [`hereIgoWithLongTextBecauseWhyNotAndWhyWouldntI`][lnk].
158+
///
159+
/// [lnk]: crate::long_code_block_link
160+
pub mod long_code_block_link {}
161+
157162
#[macro_export]
158163
macro_rules! repro {
159164
() => {};

0 commit comments

Comments
 (0)