@@ -34,7 +34,6 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
34
34
</ g></svg>');
35
35
--button-left-margin : 4px ;
36
36
--button-border-radius : 2px ;
37
- --pre-line-height : 1.5rem ;
38
37
}
39
38
40
39
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -366,7 +365,7 @@ code, pre, .code-header {
366
365
}
367
366
pre {
368
367
padding : 14px ;
369
- line-height : var ( --pre-line-height ) ; /* https://github.com/rust-lang/rust/issues/105906 */
368
+ line-height : 1.5 ; /* https://github.com/rust-lang/rust/issues/105906 */
370
369
}
371
370
pre .item-decl {
372
371
overflow-x : auto;
@@ -379,7 +378,7 @@ pre.item-decl {
379
378
.src .content pre {
380
379
padding : 20px ;
381
380
}
382
- .rustdoc .src .example-wrap pre .src-line-numbers {
381
+ .rustdoc .src .example-wrap .src-line-numbers {
383
382
padding : 20px 0 20px 4px ;
384
383
}
385
384
@@ -766,6 +765,10 @@ both the code example and the line numbers, so we need to remove the radius in t
766
765
border-bottom-left-radius : 0 ;
767
766
}
768
767
768
+ .rustdoc .scraped-example {
769
+ position : relative;
770
+ }
771
+
769
772
/* For the last child of a div, the margin will be taken care of
770
773
by the margin-top of the next item. */
771
774
.rustdoc .example-wrap : last-child {
@@ -777,19 +780,18 @@ both the code example and the line numbers, so we need to remove the radius in t
777
780
flex-grow : 1 ;
778
781
}
779
782
780
- .scraped-example : not (.expanded ) {
783
+ .scraped-example : not (.expanded ) . example-wrap {
781
784
/* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
782
785
* of lines shown in the un-expanded example code viewer. This pre needs to have
783
786
* a max-height equal to line-height * N. The line-height is currently 1.5em,
784
787
* and we include additional 10px for padding. */
785
788
max-height : calc (1.5em * 5 + 10px );
786
789
}
787
790
788
- .rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .src-line-numbers ,
791
+ .rustdoc : not (.src ) .scraped-example : not (.expanded ) .src-line-numbers ,
789
792
.rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .rust {
790
793
padding-bottom : 0 ;
791
794
/* See above comment, should be the same max-height. */
792
- max-height : calc (1.5em * 5 + 10px );
793
795
overflow : auto hidden;
794
796
}
795
797
@@ -798,7 +800,7 @@ both the code example and the line numbers, so we need to remove the radius in t
798
800
}
799
801
800
802
.rustdoc .example-wrap pre .example-line-numbers ,
801
- .rustdoc .example-wrap pre .src-line-numbers {
803
+ .rustdoc .example-wrap .src-line-numbers {
802
804
min-width : fit-content; /* prevent collapsing into nothing in truncated scraped examples */
803
805
flex-grow : 0 ;
804
806
text-align : right;
@@ -808,7 +810,7 @@ both the code example and the line numbers, so we need to remove the radius in t
808
810
color : var (--src-line-numbers-span-color );
809
811
}
810
812
811
- .rustdoc .scraped-example pre .src-line-numbers {
813
+ .rustdoc .scraped-example .src-line-numbers {
812
814
padding : 14px 0 ;
813
815
}
814
816
.src-line-numbers a , .src-line-numbers span {
@@ -2268,24 +2270,6 @@ in src-script.js and main.js
2268
2270
margin : 0 ;
2269
2271
padding : var (--nav-sub-mobile-padding );
2270
2272
}
2271
-
2272
- .example-wrap .scraped-example {
2273
- flex-wrap : wrap;
2274
- }
2275
- .example-wrap .scraped-example-title {
2276
- width : 100% ;
2277
- }
2278
- .example-wrap .scraped-example .rust {
2279
- /* Dirty hacky to force it to remain on the same line as the line numbers. */
2280
- width : 10px ;
2281
- }
2282
- .example-wrap .scraped-example .button-holder {
2283
- top : calc (var (--pre-line-height ) + 4px );
2284
- }
2285
- .scraped-example : not (.expanded )::before {
2286
- /* The gradient effect needs to be moved under the title */
2287
- top : var (--pre-line-height );
2288
- }
2289
2273
}
2290
2274
2291
2275
@@ -2310,12 +2294,6 @@ in src-script.js and main.js
2310
2294
.item-table > li > div {
2311
2295
overflow-wrap : anywhere;
2312
2296
}
2313
-
2314
- /* Starting this width, the "title" of scraped example will be in the code block so we can
2315
- put the background gradient at the top. */
2316
- .scraped-example : not (.expanded )::before {
2317
- top : 0 ;
2318
- }
2319
2297
}
2320
2298
2321
2299
@media print {
@@ -2397,20 +2375,21 @@ in src-script.js and main.js
2397
2375
color : var (--scrape-example-help-hover-color );
2398
2376
}
2399
2377
2400
- .scraped-example : not (.expanded )::before ,
2401
- .scraped-example : not (.expanded )::after {
2378
+ .scraped-example : not (.expanded ) . example-wrap ::before ,
2379
+ .scraped-example : not (.expanded ) . example-wrap ::after {
2402
2380
content : " " ;
2403
2381
width : 100% ;
2404
2382
height : 5px ;
2405
2383
position : absolute;
2406
2384
z-index : 1 ;
2407
2385
}
2408
- .scraped-example : not (.expanded )::before {
2386
+ .scraped-example : not (.expanded ) .example-wrap ::before {
2387
+ top : 0 ;
2409
2388
background : linear-gradient (to bottom,
2410
2389
var (--scrape-example-code-wrapper-background-start ),
2411
2390
var (--scrape-example-code-wrapper-background-end ));
2412
2391
}
2413
- .scraped-example : not (.expanded )::after {
2392
+ .scraped-example : not (.expanded ) . example-wrap ::after {
2414
2393
bottom : 0 ;
2415
2394
background : linear-gradient (to top,
2416
2395
var (--scrape-example-code-wrapper-background-start ),
0 commit comments