@@ -41,6 +41,7 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
4141 --font-family : "Source Serif 4" , NanumBarunGothic, serif;
4242 --font-family-code : "Source Code Pro" , monospace;
4343 --line-number-padding : 4px ;
44+ --line-number-right-margin : 20px ;
4445 /* scraped examples icons (34x33px) */
4546 --prev-arrow-image : url ('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" \
4647 enable-background= "new 0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill="none" \
@@ -848,22 +849,6 @@ ul.block, .block li, .block ul {
848849 border-radius : 6px ;
849850}
850851
851- /*
852- If the code example line numbers are displayed, there will be a weird radius in the middle from
853- both the code example and the line numbers, so we need to remove the radius in this case.
854- */
855- .rustdoc .example-wrap > .example-line-numbers ,
856- .rustdoc .scraped-example .src-line-numbers ,
857- .rustdoc .scraped-example .src-line-numbers > pre {
858- border-top-right-radius : 0 ;
859- border-bottom-right-radius : 0 ;
860- }
861- .rustdoc .example-wrap > .example-line-numbers + pre ,
862- .rustdoc .scraped-example .rust {
863- border-top-left-radius : 0 ;
864- border-bottom-left-radius : 0 ;
865- }
866-
867852.rustdoc .scraped-example {
868853 position : relative;
869854}
@@ -908,65 +893,105 @@ both the code example and the line numbers, so we need to remove the radius in t
908893 overflow : auto;
909894}
910895
911- .rustdoc .example-wrap pre .example-line-numbers ,
912- .rustdoc .example-wrap .src-line-numbers {
913- min-width : fit-content; /* prevent collapsing into nothing in truncated scraped examples */
914- flex-grow : 0 ;
915- text-align : right;
916- -moz-user-select : none;
917- -webkit-user-select : none;
918- -ms-user-select : none;
919- user-select : none;
920- padding : 14px 8px ;
921- padding-right : 2px ;
922- color : var (--src-line-numbers-span-color );
923- }
924-
925- .example-wrap .digits-1 [data-nosnippet ] {
896+ .example-wrap .digits-1 : not (.hide-lines ) [data-nosnippet ] {
926897 width : calc (1ch + var (--line-number-padding ) * 2 );
927898}
928- .example-wrap .digits-2 [data-nosnippet ] {
899+ .example-wrap .digits-2 : not (. hide-lines ) [data-nosnippet ] {
929900 width : calc (2ch + var (--line-number-padding ) * 2 );
930901}
931- .example-wrap .digits-3 [data-nosnippet ] {
902+ .example-wrap .digits-3 : not (. hide-lines ) [data-nosnippet ] {
932903 width : calc (3ch + var (--line-number-padding ) * 2 );
933904}
934- .example-wrap .digits-4 [data-nosnippet ] {
905+ .example-wrap .digits-4 : not (. hide-lines ) [data-nosnippet ] {
935906 width : calc (4ch + var (--line-number-padding ) * 2 );
936907}
937- .example-wrap .digits-5 [data-nosnippet ] {
908+ .example-wrap .digits-5 : not (. hide-lines ) [data-nosnippet ] {
938909 width : calc (5ch + var (--line-number-padding ) * 2 );
939910}
940- .example-wrap .digits-6 [data-nosnippet ] {
911+ .example-wrap .digits-6 : not (. hide-lines ) [data-nosnippet ] {
941912 width : calc (6ch + var (--line-number-padding ) * 2 );
942913}
943- .example-wrap .digits-7 [data-nosnippet ] {
914+ .example-wrap .digits-7 : not (. hide-lines ) [data-nosnippet ] {
944915 width : calc (7ch + var (--line-number-padding ) * 2 );
945916}
946- .example-wrap .digits-8 [data-nosnippet ] {
917+ .example-wrap .digits-8 : not (. hide-lines ) [data-nosnippet ] {
947918 width : calc (8ch + var (--line-number-padding ) * 2 );
948919}
949- .example-wrap .digits-9 [data-nosnippet ] {
920+ .example-wrap .digits-9 : not (. hide-lines ) [data-nosnippet ] {
950921 width : calc (9ch + var (--line-number-padding ) * 2 );
951922}
952923
953924.example-wrap [data-nosnippet ] {
954925 color : var (--src-line-numbers-span-color );
955926 text-align : right;
956927 display : inline-block;
957- margin-right : 20 px ;
928+ margin-right : var ( --line-number-right-margin ) ;
958929 -moz-user-select : none;
959930 -webkit-user-select : none;
960931 -ms-user-select : none;
961932 user-select : none;
962- padding : 0 4 px ;
933+ padding : 0 var ( --line-number-padding ) ;
963934}
964935.example-wrap [data-nosnippet ]: target {
965936 border-right : none;
966937}
967938.example-wrap .line-highlighted [data-nosnippet ] {
968939 background-color : var (--src-line-number-highlighted-background-color );
969940}
941+ : root .wrap-source-code .example-wrap [data-nosnippet ] {
942+ position : absolute;
943+ left : 0 ;
944+ }
945+ .wrap-source-code .example-wrap pre > code {
946+ position : relative;
947+ word-break : break-all;
948+ }
949+ : root .wrap-source-code .example-wrap pre > code {
950+ display : block;
951+ white-space : pre-wrap;
952+ }
953+ : root .wrap-source-code .example-wrap pre > code * {
954+ word-break : break-all;
955+ }
956+ : root .wrap-source-code .example-wrap .digits-1 pre > code {
957+ padding-left : calc (
958+ 1ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
959+ }
960+ : root .wrap-source-code .example-wrap .digits-2 pre > code {
961+ padding-left : calc (
962+ 2ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
963+ }
964+ : root .wrap-source-code .example-wrap .digits-3 pre > code {
965+ padding-left : calc (
966+ 3ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
967+ }
968+ : root .wrap-source-code .example-wrap .digits-4 pre > code {
969+ padding-left : calc (
970+ 4ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
971+ }
972+ : root .wrap-source-code .example-wrap .digits-5 pre > code {
973+ padding-left : calc (
974+ 5ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
975+ }
976+ : root .wrap-source-code .example-wrap .digits-6 pre > code {
977+ padding-left : calc (
978+ 6ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
979+ }
980+ : root .wrap-source-code .example-wrap .digits-7 pre > code {
981+ padding-left : calc (
982+ 7ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
983+ }
984+ : root .wrap-source-code .example-wrap .digits-8 pre > code {
985+ padding-left : calc (
986+ 8ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
987+ }
988+ : root .wrap-source-code .example-wrap .digits-9 pre > code {
989+ padding-left : calc (
990+ 9ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
991+ }
992+ .example-wrap .hide-lines [data-nosnippet ] {
993+ display : none;
994+ }
970995
971996.search-loading {
972997 text-align : center;
0 commit comments