@@ -760,23 +760,38 @@ ul.block, .block li {
760
760
flex-grow : 1 ;
761
761
}
762
762
763
- .rustdoc : not (.src ) .example-wrap pre {
763
+ .scraped-example : not (.expanded ) {
764
+ /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
765
+ * of lines shown in the un-expanded example code viewer. This pre needs to have
766
+ * a max-height equal to line-height * N. The line-height is currently 1.5em,
767
+ * and we include additional 10px for padding. */
768
+ max-height : calc (1.5em * 5 + 10px );
769
+ }
770
+
771
+ .rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .src-line-numbers ,
772
+ .rustdoc : not (.src ) .scraped-example : not (.expanded ) pre .rust {
773
+ padding-bottom : 0 ;
774
+ /* See above comment, should be the same max-height. */
775
+ max-height : calc (1.5em * 5 + 10px );
764
776
overflow : auto hidden;
765
777
}
766
778
779
+ .rustdoc : not (.src ) .example-wrap pre {
780
+ overflow : auto;
781
+ }
782
+
767
783
.rustdoc .example-wrap pre .example-line-numbers ,
768
784
.rustdoc .example-wrap pre .src-line-numbers {
769
- flex-grow : 0 ;
770
785
min-width : fit-content; /* prevent collapsing into nothing in truncated scraped examples */
771
- overflow : initial ;
786
+ flex-grow : 0 ;
772
787
text-align : right;
773
788
-webkit-user-select : none;
774
789
user-select : none;
775
790
padding : 14px 8px ;
776
791
color : var (--src-line-numbers-span-color );
777
792
}
778
793
779
- .rustdoc .example-wrap pre .src-line-numbers {
794
+ .rustdoc .scraped-example pre .src-line-numbers {
780
795
padding : 14px 0 ;
781
796
}
782
797
.src-line-numbers a , .src-line-numbers span {
@@ -1488,17 +1503,23 @@ instead, we check that it's not a "finger" cursor.
1488
1503
.example-wrap .button-holder .keep-visible {
1489
1504
visibility : visible;
1490
1505
}
1491
- .example-wrap .button-holder . copy-button , . example-wrap . test-arrow {
1506
+ .example-wrap .button-holder > * {
1492
1507
background : var (--main-background-color );
1493
1508
cursor : pointer;
1494
1509
border-radius : var (--button-border-radius );
1495
1510
height : var (--copy-path-height );
1496
1511
width : var (--copy-path-width );
1512
+ border : 0 ;
1513
+ color : var (--code-example-button-color );
1497
1514
}
1498
- .example-wrap .button-holder .copy-button {
1515
+ .example-wrap .button-holder > * : hover {
1516
+ color : var (--code-example-button-hover-color );
1517
+ }
1518
+ .example-wrap .button-holder > * : not (: first-child ) {
1499
1519
margin-left : var (--button-left-margin );
1520
+ }
1521
+ .example-wrap .button-holder .copy-button {
1500
1522
padding : 2px 0 0 4px ;
1501
- border : 0 ;
1502
1523
}
1503
1524
.example-wrap .button-holder .copy-button ::before ,
1504
1525
.example-wrap .test-arrow ::before {
@@ -2334,99 +2355,41 @@ in src-script.js and main.js
2334
2355
color : var (--scrape-example-help-hover-color );
2335
2356
}
2336
2357
2337
- .scraped-example {
2338
- /* So .scraped-example-title can be positioned absolutely */
2339
- position : relative;
2340
- }
2341
-
2342
- .scraped-example .code-wrapper {
2343
- position : relative;
2344
- display : flex;
2345
- flex-direction : row;
2346
- flex-wrap : wrap;
2347
- width : 100% ;
2348
- }
2349
-
2350
- .scraped-example : not (.expanded ) .code-wrapper {
2351
- /* scrape-examples.js has a constant DEFAULT_MAX_LINES (call it N) for the number
2352
- * of lines shown in the un-expanded example code viewer. This pre needs to have
2353
- * a max-height equal to line-height * N. The line-height is currently 1.5em,
2354
- * and we include additional 10px for padding. */
2355
- max-height : calc (1.5em * 5 + 10px );
2356
- }
2357
-
2358
- .scraped-example : not (.expanded ) .code-wrapper pre {
2359
- overflow-y : hidden;
2360
- padding-bottom : 0 ;
2361
- /* See above comment, should be the same max-height. */
2362
- max-height : calc (1.5em * 5 + 10px );
2363
- }
2364
-
2365
- .more-scraped-examples .scraped-example : not (.expanded ) .code-wrapper ,
2366
- .more-scraped-examples .scraped-example : not (.expanded ) .code-wrapper pre {
2367
- /* See above comment, except this height is based on HIDDEN_MAX_LINES. */
2368
- max-height : calc (1.5em * 10 + 10px );
2369
- }
2370
-
2371
- .scraped-example .code-wrapper .next ,
2372
- .scraped-example .code-wrapper .prev ,
2373
- .scraped-example .code-wrapper .expand {
2374
- color : var (--main-color );
2375
- position : absolute;
2376
- top : 0.25em ;
2377
- z-index : 1 ;
2378
- padding : 0 ;
2379
- background : none;
2380
- border : none;
2381
- /* iOS button gradient: https://stackoverflow.com/q/5438567 */
2382
- -webkit-appearance : none;
2383
- opacity : 1 ;
2384
- }
2385
- .scraped-example .code-wrapper .prev {
2386
- right : 2.25em ;
2387
- }
2388
- .scraped-example .code-wrapper .next {
2389
- right : 1.25em ;
2390
- }
2391
- .scraped-example .code-wrapper .expand {
2392
- right : 0.25em ;
2393
- }
2394
-
2395
- .scraped-example : not (.expanded ) .code-wrapper ::before ,
2396
- .scraped-example : not (.expanded ) .code-wrapper ::after {
2358
+ .scraped-example : not (.expanded )::before ,
2359
+ .scraped-example : not (.expanded )::after {
2397
2360
content : " " ;
2398
2361
width : 100% ;
2399
2362
height : 5px ;
2400
2363
position : absolute;
2401
2364
z-index : 1 ;
2402
2365
}
2403
- .scraped-example : not (.expanded ) . code-wrapper ::before {
2366
+ .scraped-example : not (.expanded )::before {
2404
2367
top : 0 ;
2405
2368
background : linear-gradient (to bottom,
2406
2369
var (--scrape-example-code-wrapper-background-start ),
2407
2370
var (--scrape-example-code-wrapper-background-end ));
2408
2371
}
2409
- .scraped-example : not (.expanded ) . code-wrapper ::after {
2372
+ .scraped-example : not (.expanded )::after {
2410
2373
bottom : 0 ;
2411
2374
background : linear-gradient (to top,
2412
2375
var (--scrape-example-code-wrapper-background-start ),
2413
2376
var (--scrape-example-code-wrapper-background-end ));
2414
2377
}
2415
2378
2416
- .scraped-example . code-wrapper . example-wrap {
2379
+ .scraped-example : not (. expanded ) {
2417
2380
width : 100% ;
2418
2381
overflow-y : hidden;
2419
2382
margin-bottom : 0 ;
2420
2383
}
2421
2384
2422
- .scraped-example : not (.expanded ) . code-wrapper . example-wrap {
2385
+ .scraped-example : not (.expanded ) {
2423
2386
overflow-x : hidden;
2424
2387
}
2425
2388
2426
- .scraped-example .example-wrap . rust span .highlight {
2389
+ .scraped-example .rust span .highlight {
2427
2390
background : var (--scrape-example-code-line-highlight );
2428
2391
}
2429
- .scraped-example .example-wrap . rust span .highlight .focus {
2392
+ .scraped-example .rust span .highlight .focus {
2430
2393
background : var (--scrape-example-code-line-highlight-focus );
2431
2394
}
2432
2395
@@ -2520,6 +2483,8 @@ by default.
2520
2483
--copy-path-button-color : # 999 ;
2521
2484
--copy-path-img-filter : invert (50% );
2522
2485
--copy-path-img-hover-filter : invert (35% );
2486
+ --code-example-button-color : # 7f7f7f ;
2487
+ --code-example-button-hover-color : # 595959 ;
2523
2488
--codeblock-error-hover-color : rgb (255 , 0 , 0 );
2524
2489
--codeblock-error-color : rgba (255 , 0 , 0 , .5 );
2525
2490
--codeblock-ignore-hover-color : rgb (255 , 142 , 0 );
@@ -2622,6 +2587,8 @@ by default.
2622
2587
--copy-path-button-color : # 999 ;
2623
2588
--copy-path-img-filter : invert (50% );
2624
2589
--copy-path-img-hover-filter : invert (65% );
2590
+ --code-example-button-color : # 7f7f7f ;
2591
+ --code-example-button-hover-color : # a5a5a5 ;
2625
2592
--codeblock-error-hover-color : rgb (255 , 0 , 0 );
2626
2593
--codeblock-error-color : rgba (255 , 0 , 0 , .5 );
2627
2594
--codeblock-ignore-hover-color : rgb (255 , 142 , 0 );
@@ -2731,6 +2698,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
2731
2698
--copy-path-button-color : # fff ;
2732
2699
--copy-path-img-filter : invert (70% );
2733
2700
--copy-path-img-hover-filter : invert (100% );
2701
+ --code-example-button-color : # b2b2b2 ;
2702
+ --code-example-button-hover-color : # fff ;
2734
2703
--codeblock-error-hover-color : rgb (255 , 0 , 0 );
2735
2704
--codeblock-error-color : rgba (255 , 0 , 0 , .5 );
2736
2705
--codeblock-ignore-hover-color : rgb (255 , 142 , 0 );
0 commit comments