|
115 | 115 | margin: var(--spacing-lg) 0; |
116 | 116 | text-align: center; |
117 | 117 | } |
| 118 | +.content .code-block { |
| 119 | + position: relative; |
| 120 | + display: block; |
| 121 | + text-align: center; |
| 122 | + margin-bottom: var(--spacing-md); |
| 123 | +} |
| 124 | + |
| 125 | +.content .code-block.collapsed pre { |
| 126 | + max-height: 340px; |
| 127 | + overflow: hidden; |
| 128 | +} |
| 129 | + |
| 130 | +.content .code-block pre { |
| 131 | + margin-bottom: 0; |
| 132 | + position: relative; |
| 133 | + padding-top: 44px; |
| 134 | + padding-bottom: 36px; |
| 135 | +} |
| 136 | + |
| 137 | +.content .code-block .code-fade { |
| 138 | + position: absolute; |
| 139 | + left: 0; |
| 140 | + right: 0; |
| 141 | + bottom: 0; |
| 142 | + height: 56px; |
| 143 | + border-bottom-left-radius: var(--radius-sm); |
| 144 | + border-bottom-right-radius: var(--radius-sm); |
| 145 | + pointer-events: none; |
| 146 | + z-index: 1; |
| 147 | +} |
| 148 | + |
| 149 | +.content .code-block:not(.collapsed) .code-fade { |
| 150 | + display: none; |
| 151 | +} |
| 152 | + |
| 153 | +.content .code-block pre .code-toggle { |
| 154 | + position: absolute; |
| 155 | + font-family: var(--font-family); |
| 156 | + right: 12px; |
| 157 | + bottom: 8px; |
| 158 | + z-index: 2; |
| 159 | + font-size: 0.85em; |
| 160 | + color: inherit; |
| 161 | + cursor: pointer; |
| 162 | + background: transparent; |
| 163 | + padding: 0; |
| 164 | +} |
118 | 165 |
|
119 | 166 | .content figcaption { |
120 | 167 | font-size: var(--font-size-sm); |
121 | 168 | color: var(--text-muted); |
122 | 169 | margin-top: var(--spacing-xs); |
123 | 170 | font-style: italic; |
124 | 171 | } |
| 172 | + |
| 173 | +.content .code-block + h1, |
| 174 | +.content .code-block + h2, |
| 175 | +.content .code-block + h3, |
| 176 | +.content .code-block + h4, |
| 177 | +.content .code-block + h5, |
| 178 | +.content .code-block + h6 { |
| 179 | + margin-top: var(--spacing-md); |
| 180 | +} |
| 181 | + |
| 182 | +.content .code-block pre .code-toolbar { |
| 183 | + position: absolute; |
| 184 | + top: 0; |
| 185 | + left: 0; |
| 186 | + right: 0; |
| 187 | + height: 36px; |
| 188 | + display: flex; |
| 189 | + align-items: center; |
| 190 | + justify-content: space-between; |
| 191 | + padding: 6px 12px; |
| 192 | + gap: 8px; |
| 193 | + z-index: 2; |
| 194 | + background: transparent; |
| 195 | + border-bottom: 1px solid var(--border-color); |
| 196 | +} |
| 197 | + |
| 198 | +.content .code-block pre .code-lang { |
| 199 | + font-family: var(--font-family); |
| 200 | + font-size: 0.8em; |
| 201 | + border: 1px solid currentColor; |
| 202 | + color: currentColor; |
| 203 | + background: color-mix(in srgb, currentColor 18%, transparent); |
| 204 | + padding: 2px 10px; |
| 205 | + border-radius: 999px; |
| 206 | + line-height: 1; |
| 207 | +} |
| 208 | + |
| 209 | +.content .code-block pre .code-copy { |
| 210 | + font-family: var(--font-family); |
| 211 | + width: 28px; |
| 212 | + height: 28px; |
| 213 | + display: inline-flex; |
| 214 | + align-items: center; |
| 215 | + justify-content: center; |
| 216 | + border: none; |
| 217 | + background: transparent; |
| 218 | + color: white; |
| 219 | + border-radius: var(--radius-sm); |
| 220 | + cursor: pointer; |
| 221 | +} |
| 222 | + |
| 223 | +.content .code-block pre .code-copy:hover { |
| 224 | + background: color-mix(in srgb, currentColor 10%, transparent); |
| 225 | + color: var(--brand-primary); |
| 226 | +} |
| 227 | + |
| 228 | +.content .code-block pre .code-copy svg { |
| 229 | + width: 16px; |
| 230 | + height: 16px; |
| 231 | + display: block; |
| 232 | + fill: currentColor; |
| 233 | +} |
0 commit comments