@@ -41,6 +41,7 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
41
41
--font-family : "Source Serif 4" , NanumBarunGothic, serif;
42
42
--font-family-code : "Source Code Pro" , monospace;
43
43
--line-number-padding : 4px ;
44
+ --line-number-right-margin : 20px ;
44
45
}
45
46
46
47
: root .sans-serif {
@@ -835,22 +836,6 @@ ul.block, .block li, .block ul {
835
836
border-radius : 6px ;
836
837
}
837
838
838
- /*
839
- If the code example line numbers are displayed, there will be a weird radius in the middle from
840
- both the code example and the line numbers, so we need to remove the radius in this case.
841
- */
842
- .rustdoc .example-wrap > .example-line-numbers ,
843
- .rustdoc .scraped-example .src-line-numbers ,
844
- .rustdoc .scraped-example .src-line-numbers > pre {
845
- border-top-right-radius : 0 ;
846
- border-bottom-right-radius : 0 ;
847
- }
848
- .rustdoc .example-wrap > .example-line-numbers + pre ,
849
- .rustdoc .scraped-example .rust {
850
- border-top-left-radius : 0 ;
851
- border-bottom-left-radius : 0 ;
852
- }
853
-
854
839
.rustdoc .scraped-example {
855
840
position : relative;
856
841
}
@@ -895,65 +880,105 @@ both the code example and the line numbers, so we need to remove the radius in t
895
880
overflow : auto;
896
881
}
897
882
898
- .rustdoc .example-wrap pre .example-line-numbers ,
899
- .rustdoc .example-wrap .src-line-numbers {
900
- min-width : fit-content; /* prevent collapsing into nothing in truncated scraped examples */
901
- flex-grow : 0 ;
902
- text-align : right;
903
- -moz-user-select : none;
904
- -webkit-user-select : none;
905
- -ms-user-select : none;
906
- user-select : none;
907
- padding : 14px 8px ;
908
- padding-right : 2px ;
909
- color : var (--src-line-numbers-span-color );
910
- }
911
-
912
- .example-wrap .digits-1 [data-nosnippet ] {
883
+ .example-wrap .digits-1 : not (.hide-lines ) [data-nosnippet ] {
913
884
width : calc (1ch + var (--line-number-padding ) * 2 );
914
885
}
915
- .example-wrap .digits-2 [data-nosnippet ] {
886
+ .example-wrap .digits-2 : not (. hide-lines ) [data-nosnippet ] {
916
887
width : calc (2ch + var (--line-number-padding ) * 2 );
917
888
}
918
- .example-wrap .digits-3 [data-nosnippet ] {
889
+ .example-wrap .digits-3 : not (. hide-lines ) [data-nosnippet ] {
919
890
width : calc (3ch + var (--line-number-padding ) * 2 );
920
891
}
921
- .example-wrap .digits-4 [data-nosnippet ] {
892
+ .example-wrap .digits-4 : not (. hide-lines ) [data-nosnippet ] {
922
893
width : calc (4ch + var (--line-number-padding ) * 2 );
923
894
}
924
- .example-wrap .digits-5 [data-nosnippet ] {
895
+ .example-wrap .digits-5 : not (. hide-lines ) [data-nosnippet ] {
925
896
width : calc (5ch + var (--line-number-padding ) * 2 );
926
897
}
927
- .example-wrap .digits-6 [data-nosnippet ] {
898
+ .example-wrap .digits-6 : not (. hide-lines ) [data-nosnippet ] {
928
899
width : calc (6ch + var (--line-number-padding ) * 2 );
929
900
}
930
- .example-wrap .digits-7 [data-nosnippet ] {
901
+ .example-wrap .digits-7 : not (. hide-lines ) [data-nosnippet ] {
931
902
width : calc (7ch + var (--line-number-padding ) * 2 );
932
903
}
933
- .example-wrap .digits-8 [data-nosnippet ] {
904
+ .example-wrap .digits-8 : not (. hide-lines ) [data-nosnippet ] {
934
905
width : calc (8ch + var (--line-number-padding ) * 2 );
935
906
}
936
- .example-wrap .digits-9 [data-nosnippet ] {
907
+ .example-wrap .digits-9 : not (. hide-lines ) [data-nosnippet ] {
937
908
width : calc (9ch + var (--line-number-padding ) * 2 );
938
909
}
939
910
940
911
.example-wrap [data-nosnippet ] {
941
912
color : var (--src-line-numbers-span-color );
942
913
text-align : right;
943
914
display : inline-block;
944
- margin-right : 20 px ;
915
+ margin-right : var ( --line-number-right-margin ) ;
945
916
-moz-user-select : none;
946
917
-webkit-user-select : none;
947
918
-ms-user-select : none;
948
919
user-select : none;
949
- padding : 0 4 px ;
920
+ padding : 0 var ( --line-number-padding ) ;
950
921
}
951
922
.example-wrap [data-nosnippet ]: target {
952
923
border-right : none;
953
924
}
954
925
.example-wrap .line-highlighted [data-nosnippet ] {
955
926
background-color : var (--src-line-number-highlighted-background-color );
956
927
}
928
+ : root .wrap-source-code .example-wrap [data-nosnippet ] {
929
+ position : absolute;
930
+ left : 0 ;
931
+ }
932
+ .wrap-source-code .example-wrap pre > code {
933
+ position : relative;
934
+ word-break : break-all;
935
+ }
936
+ : root .wrap-source-code .example-wrap pre > code {
937
+ display : block;
938
+ white-space : pre-wrap;
939
+ }
940
+ : root .wrap-source-code .example-wrap pre > code * {
941
+ word-break : break-all;
942
+ }
943
+ : root .wrap-source-code .example-wrap .digits-1 pre > code {
944
+ padding-left : calc (
945
+ 1ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
946
+ }
947
+ : root .wrap-source-code .example-wrap .digits-2 pre > code {
948
+ padding-left : calc (
949
+ 2ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
950
+ }
951
+ : root .wrap-source-code .example-wrap .digits-3 pre > code {
952
+ padding-left : calc (
953
+ 3ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
954
+ }
955
+ : root .wrap-source-code .example-wrap .digits-4 pre > code {
956
+ padding-left : calc (
957
+ 4ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
958
+ }
959
+ : root .wrap-source-code .example-wrap .digits-5 pre > code {
960
+ padding-left : calc (
961
+ 5ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
962
+ }
963
+ : root .wrap-source-code .example-wrap .digits-6 pre > code {
964
+ padding-left : calc (
965
+ 6ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
966
+ }
967
+ : root .wrap-source-code .example-wrap .digits-7 pre > code {
968
+ padding-left : calc (
969
+ 7ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
970
+ }
971
+ : root .wrap-source-code .example-wrap .digits-8 pre > code {
972
+ padding-left : calc (
973
+ 8ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
974
+ }
975
+ : root .wrap-source-code .example-wrap .digits-9 pre > code {
976
+ padding-left : calc (
977
+ 9ch + var (--line-number-padding ) * 2 + var (--line-number-right-margin ));
978
+ }
979
+ .example-wrap .hide-lines [data-nosnippet ] {
980
+ display : none;
981
+ }
957
982
958
983
.search-loading {
959
984
text-align : center;
0 commit comments