|
| 1 | +/* Custom CSS for the Rust Specification. */ |
| 2 | + |
1 | 3 | /*
|
2 | 4 | .parenthetical class used to keep e.g. "less-than symbol (<)" from wrapping
|
3 | 5 | the end parenthesis onto its own line. Use in a span between the last word and
|
@@ -51,3 +53,167 @@ main .warning p::before {
|
51 | 53 | .ayu main .warning p a {
|
52 | 54 | color: #80d0d0;
|
53 | 55 | }
|
| 56 | + |
| 57 | +/* <kbd> tags can be used to highlight specific character elements. */ |
| 58 | +kbd { |
| 59 | + border: 1px solid #999; |
| 60 | + display: inline-block; |
| 61 | + border-radius: 3px; |
| 62 | + padding: 0 0.6ex; |
| 63 | + background: #eee; |
| 64 | + box-shadow: inset -1px -1px 0 #999; |
| 65 | + vertical-align: baseline; |
| 66 | + color: #000; |
| 67 | + height: 1.55em; |
| 68 | + font-style: normal; |
| 69 | + font-weight: bold; |
| 70 | + font-family: inherit; |
| 71 | + font-size: revert; |
| 72 | + line-height: revert; |
| 73 | +} |
| 74 | +kbd.optional { |
| 75 | + border-style: dashed; |
| 76 | + background: #fff; |
| 77 | +} |
| 78 | +var.optional { |
| 79 | + border-style: dashed; |
| 80 | +} |
| 81 | + |
| 82 | +/* <var> tags can be used for non-terminals. */ |
| 83 | +var { |
| 84 | + border: 1px solid #9c9; |
| 85 | + box-shadow: inset -1px -1px 0 #9c9; |
| 86 | + font-style: normal; |
| 87 | + display: inline-block; |
| 88 | + vertical-align: baseline; |
| 89 | + border-radius: 7px; |
| 90 | + padding: 0 4px; |
| 91 | + background: #dfd; |
| 92 | + margin: 2px; |
| 93 | +} |
| 94 | +var.type { |
| 95 | + box-shadow: inset -1px -1px 0 #c99; |
| 96 | + border-color: #c99; |
| 97 | + background: #fdd; |
| 98 | +} |
| 99 | + |
| 100 | +/* <span class="repeat"> can be used for a grammar production that repeats zero or more times. */ |
| 101 | +span.repeat { |
| 102 | + position: relative; |
| 103 | + border: 1px dashed #393; |
| 104 | + border-radius: 10px; |
| 105 | + display: inline-block; |
| 106 | + padding: 6px; |
| 107 | + margin-left: 0.5ex; |
| 108 | + margin-top: 1em; |
| 109 | + margin-bottom: 0.5ex; |
| 110 | + min-width: 3.8em; |
| 111 | + text-align: center; |
| 112 | +} |
| 113 | +span.repeat::before { |
| 114 | + content: "zero or more"; |
| 115 | + white-space: nowrap; |
| 116 | + display: block; |
| 117 | + text-align: center; |
| 118 | + font-size: 0.75em; |
| 119 | + position: absolute; |
| 120 | + left: 0; |
| 121 | + right: 0; |
| 122 | + top: -1.4em; |
| 123 | + color: #393; |
| 124 | +} |
| 125 | +var > span { |
| 126 | + display: inline-block; |
| 127 | + border-right: 1px dotted green; |
| 128 | + padding-right: 0.5ex; |
| 129 | + margin-right: 0.5ex; |
| 130 | + font-style: italic; |
| 131 | +} |
| 132 | + |
| 133 | +/* <span class="version"> can be used to highlight a specific version of Rust. */ |
| 134 | +span.version { |
| 135 | + float: right; |
| 136 | + margin-left: 1em; |
| 137 | + margin-bottom: 1em; |
| 138 | + background: #f7c0eb; |
| 139 | + padding: 0.2ex 0.5ex; |
| 140 | + border-radius: 5px; |
| 141 | + display: block; |
| 142 | + box-shadow: inset -1px -1px 0 #a06894; |
| 143 | + font-size: 0.9em; |
| 144 | +} |
| 145 | + |
| 146 | +/* <dfn> tags are used to indicate a specific word or phrase is being defined. */ |
| 147 | +dfn { |
| 148 | + font-style: italic; |
| 149 | + text-decoration: underline; |
| 150 | +} |
| 151 | + |
| 152 | +.content main { |
| 153 | + /* Provides space on the left for the rule call-outs. */ |
| 154 | + padding-left: 4em; |
| 155 | +} |
| 156 | + |
| 157 | +/* Rules are generated via r[foo.bar] syntax, processed by mdbook-spec. */ |
| 158 | +.rule { |
| 159 | + /* Allows the rule to be positioned. */ |
| 160 | + position: relative; |
| 161 | + /* Position slightly to the left. */ |
| 162 | + left: -4em; |
| 163 | + color: #999; |
| 164 | + font-size: 0.8em; |
| 165 | +} |
| 166 | +/* mdbook will wrap the rule content in a <p> tag, with a margin. However, we |
| 167 | + don't need the extra space |
| 168 | +*/ |
| 169 | +.rule ~ p { |
| 170 | + margin-top: 0px; |
| 171 | +} |
| 172 | + |
| 173 | +/* Change the default styling of blockquotes. */ |
| 174 | +blockquote { |
| 175 | + padding: 1ex 1em; |
| 176 | + margin: 1ex; |
| 177 | + margin-left: 2em; |
| 178 | + /* vw units allow this to be adaptive to the screen size so it isn't too small on mobile. */ |
| 179 | + margin-right: 12vw; |
| 180 | +} |
| 181 | + |
| 182 | +/* mdbook will wrap the blockquote content in a <p> tag, with a margin. However, |
| 183 | + that adds too much space, so remove it. |
| 184 | +*/ |
| 185 | +blockquote > p { |
| 186 | + margin-top: 0px; |
| 187 | + margin-bottom: 0px; |
| 188 | +} |
| 189 | + |
| 190 | +/* When the sidebar is visible, reduce the spacing of rules so that the |
| 191 | + content doesn't get shifted too far, and make the text too narrow. |
| 192 | +*/ |
| 193 | +.sidebar-visible .rule { |
| 194 | + left: -1em; |
| 195 | +} |
| 196 | +.sidebar-visible .content main { |
| 197 | + padding-left: 1em; |
| 198 | +} |
| 199 | + |
| 200 | +/* Remove the blue coloring of links on rules that mdbook normally sets. */ |
| 201 | +.rule-link { |
| 202 | + color: #999 !important; |
| 203 | +} |
| 204 | + |
| 205 | +/* When clicking a rule, it is added as a URL fragment and the browser will |
| 206 | + navigate to it. This adds an indicator that the linked rule is the one that |
| 207 | + is "current", just like normal headers are in mdbook. |
| 208 | +*/ |
| 209 | +.rule:target::before { |
| 210 | + display: inline-block; |
| 211 | + content: "»"; |
| 212 | + margin-inline-start: -20px; |
| 213 | + width: 20px; |
| 214 | +} |
| 215 | + |
| 216 | +/* Sets the color for [!HISTORY] blockquote admonitions. */ |
| 217 | +.history > blockquote { |
| 218 | + background: #f7c0eb; |
| 219 | +} |
0 commit comments