1111 --railroad-rect-fill : hsl (-290 , 70% , 90% );
1212}
1313.light {
14- --alert-note-color : # 0969da ;
15- --alert-warning-color : # 9a6700 ;
1614 --alert-edition-color : # 1a7f37 ;
1715 --alert-example-color : # 8250df ;
1816 --grammar-literal-bg : # fafafa ;
1917}
2018.rust {
21- --alert-note-color : # 023b95 ;
22- --alert-warning-color : # 603700 ;
2319 --alert-edition-color : # 008200 ;
2420 --alert-example-color : # 8250df ;
2521 --grammar-literal-bg : # dedede ;
2925 --inline-code-color : var (--grammar-comment-color );
3026}
3127.coal , .navy {
32- --alert-note-color : # 4493f8 ;
33- --alert-warning-color : # d29922 ;
3428 --alert-edition-color : # 3fb950 ;
3529 --alert-example-color : # ab7df8 ;
3630 --grammar-literal-bg : # 1d1f21 ;
3731}
3832.ayu {
39- --alert-note-color : # 74b9ff ;
40- --alert-warning-color : # f0b72f ;
4133 --alert-edition-color : # 2bd853 ;
4234 --alert-example-color : # d3abff ;
4335 --grammar-literal-bg : # 191f26 ;
@@ -68,12 +60,18 @@ the parenthetical. So for this example, you'd use
6860/*
6961Admonitions are defined with blockquotes:
7062
71- > [!WARNING ]
63+ > [!EXAMPLE ]
7264> This is bad!
7365
74- See tools/mdbook-spec/src/admonitions.rs.
66+ The admonitions from tools/mdbook-spec/src/admonitions.rs are custom ones for
67+ the reference (e.g. examples), upstream mdbook also provides some (like for
68+ `[!WARNING]`, use consistent styles for both).
69+
70+ Some of the styles specified below for the upstream admonitions already match
71+ the upstream styles but are included for consistency.
7572*/
76- .alert blockquote {
73+ .alert blockquote ,
74+ blockquote .blockquote-tag {
7775 /* Add some padding to make the vertical bar a little taller than the text.*/
7876 padding : 8px 0px 8px 20px ;
7977 /* Add a solid color bar on the left side. */
@@ -84,54 +82,40 @@ See tools/mdbook-spec/src/admonitions.rs.
8482 /* Disable border blocks from mdbook. */
8583 border-block-start : none;
8684 border-block-end : none;
87- /* Reduce margin from mdbook, it uses a lot of space. */
88- margin : 10px 0 ;
85+ /* Reduce margin from mdbook, it uses a lot of space.
86+ Important to override `main > ul > li > *:last-child` rule. */
87+ margin : 10px 0 !important ;
8988}
9089
91- .alert-title {
92- /* Slightly increase the weight for more emphasis. */
93- font-weight : 600 ;
94- /* Vertically center the icon with the text. */
95- display : flex;
96- align-items : center;
90+ .blockquote-tag-title {
9791 /* Remove default large margins for a more compact display.
9892 Important to override .alert p rule. */
9993 margin : 0 0 8px 0 !important ;
10094}
101- .alert blockquote > : nth-child (2 ) {
95+ .alert blockquote > : nth-child (2 ),
96+ blockquote .blockquote-tag > : nth-child (2 ) {
10297 /* Default margins of content just below the label add too much space. */
10398 margin-top : 0 ;
10499}
105- .alert blockquote > : last-child {
100+ .alert blockquote > : last-child ,
101+ blockquote .blockquote-tag > : last-child {
106102 /* Default margins of content add too much space. */
107103 margin-bottom : 0 ;
108104}
109105
110- .alert -title svg {
106+ .blockquote-tag -title svg {
111107 fill : currentColor;
112108 /* Add some space between the icon and the text. */
113109 margin-right : 8px ;
114110}
115111
116- .alert-note blockquote {
117- border-inline-start-color : var (--alert-note-color );
118- }
119- .alert-warning blockquote {
120- border-inline-start-color : var (--alert-warning-color );
121- }
122112.alert-edition blockquote {
123113 border-inline-start-color : var (--alert-edition-color );
124114}
125115.alert-example blockquote {
126116 border-inline-start-color : var (--alert-example-color );
127117}
128- .alert-note .alert-title {
129- color : var (--alert-note-color );
130- }
131- .alert-warning .alert-title {
132- color : var (--alert-warning-color );
133- }
134- .alert-edition .alert-title {
118+ .alert-edition .blockquote-tag-title {
135119 color : var (--alert-edition-color );
136120}
137121/* Puts a rounded rectangle around the edition date. */
@@ -143,7 +127,7 @@ See tools/mdbook-spec/src/admonitions.rs.
143127 font-weight : bold;
144128 color : var (--alert-edition-color );
145129}
146- .alert-example .alert -title {
130+ .alert-example .blockquote-tag -title {
147131 color : var (--alert-example-color );
148132}
149133
0 commit comments