| 1 |
@use "../utilities/break"; |
| 2 |
@use "../utilities/convert"; |
| 3 |
|
| 4 |
:root > * { |
| 5 |
--highlight-svg-console: svg-load("@mdi/svg/svg/console.svg"); |
| 6 |
--highlight-svg-arrow-expand: svg-load("@mdi/svg/svg/arrow-expand.svg"); |
| 7 |
--highlight-svg-arrow-collapse: svg-load("@mdi/svg/svg/arrow-collapse.svg"); |
| 8 |
} |
| 9 |
|
| 10 |
.highlight { |
| 11 |
.hll { |
| 12 |
box-shadow: 2px 0 0 0 var(--md-accent-fg-color) inset; |
| 13 |
} |
| 14 |
|
| 15 |
.kc { // Keyword constant |
| 16 |
color: var(--md-code-hl-constant-color); |
| 17 |
} |
| 18 |
|
| 19 |
.nc, // Name, class |
| 20 |
.ne, // Name, exception |
| 21 |
{ |
| 22 |
color: var(--md-code-hl-class-color); |
| 23 |
} |
| 24 |
|
| 25 |
.mb { |
| 26 |
color: var(--md-code-hl-number-color); |
| 27 |
} |
| 28 |
|
| 29 |
.nb, // Name, builtin |
| 30 |
.bp { // Name, builtin pseudo |
| 31 |
color: var(--md-code-hl-builtin-color); |
| 32 |
} |
| 33 |
|
| 34 |
.nn { // Name, namespace Name, namespace Name, namespace Name, namespace |
| 35 |
color: var(--md-code-hl-namespace-color); |
| 36 |
} |
| 37 |
|
| 38 |
.na, // Name, attribute |
| 39 |
.nd, // Name, decorator |
| 40 |
.ni { // Name, entity |
| 41 |
color: var(--md-code-hl-entity-color); |
| 42 |
} |
| 43 |
.nl, // Name, label |
| 44 |
.nt { // Name, tag |
| 45 |
color: var(--md-code-hl-tag-color); |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
.md-typeset { |
| 50 |
|
| 51 |
/* Allow code to look like code everywhere despite Material's current preference */ |
| 52 |
*:not(pre) > code { |
| 53 |
margin: 0; |
| 54 |
padding: convert.px2em( 2.25px, 13.6px) convert.px2em( 4.25px, 13.6px); |
| 55 |
color: var(--md-code-fg-color); |
| 56 |
background-color: var(--md-code-inline-bg-color); |
| 57 |
border-radius: convert.px2rem(4px); |
| 58 |
box-shadow: none; |
| 59 |
} |
| 60 |
|
| 61 |
pre > code { |
| 62 |
display: grid; |
| 63 |
} |
| 64 |
|
| 65 |
/* Don't always like code breaking in table cells */ |
| 66 |
td code { |
| 67 |
word-break: normal; |
| 68 |
} |
| 69 |
|
| 70 |
.highlight { |
| 71 |
|
| 72 |
/* Needed for tab preserving mode */ |
| 73 |
tab-size: 8; |
| 74 |
|
| 75 |
/* `pymdownx-inline` mode */ |
| 76 |
[data-linenos] { |
| 77 |
|
| 78 |
&:hover::before { |
| 79 |
color: var(--md-accent-fg-color); |
| 80 |
font-weight: 700; |
| 81 |
} |
| 82 |
|
| 83 |
/* Special line mode coloring */ |
| 84 |
&.special::before { |
| 85 |
background-color: var(--md-code-special-bg-color); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
.hll [data-linenos]::before { |
| 90 |
box-shadow: -2px 0 var(--md-accent-fg-color) inset; |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
/* Special line number coloring for tables */ |
| 95 |
.highlighttable { |
| 96 |
.linenodiv { |
| 97 |
.special { |
| 98 |
margin-right: convert.px2em(-8px, 13.6px); |
| 99 |
margin-left: convert.px2em(-16px, 13.6px); |
| 100 |
padding-right: convert.px2em(8px, 13.6px); |
| 101 |
padding-left: convert.px2em(16px, 13.6px); |
| 102 |
background-color: var(--md-code-special-bg-color); |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
// Filename span |
| 108 |
.highlight span.filename { |
| 109 |
|
| 110 |
// Style the filename banner |
| 111 |
position: relative; |
| 112 |
display: block; |
| 113 |
margin-top: 1em; |
| 114 |
padding: convert.px2em(8px) convert.px2em(16px, 13.6px) convert.px2em(8px) convert.px2em(40px, 13.6px); |
| 115 |
font-weight: 700; |
| 116 |
font-size: convert.px2rem(13.6px); |
| 117 |
background-color: var(--md-code-title-bg-color); |
| 118 |
border-top-left-radius: convert.px2rem(9.6px); |
| 119 |
border-top-right-radius: convert.px2rem(9.6px); |
| 120 |
|
| 121 |
// Adjust margins and and general container look of code block |
| 122 |
+ pre { |
| 123 |
margin-top: 0; |
| 124 |
|
| 125 |
code { |
| 126 |
border-top-left-radius: 0; |
| 127 |
border-top-right-radius: 0; |
| 128 |
} |
| 129 |
} |
| 130 |
|
| 131 |
// Add code icon |
| 132 |
&::before { |
| 133 |
position: absolute; |
| 134 |
left: convert.px2em(12px, 13.6px); |
| 135 |
width: convert.px2em(20px, 13.6px); |
| 136 |
height: convert.px2em(20px, 13.6px); |
| 137 |
background-color: var(--md-default-fg-color); |
| 138 |
mask-image: var(--highlight-svg-console); |
| 139 |
mask-repeat: no-repeat; |
| 140 |
mask-size: contain; |
| 141 |
content: ""; |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
.collapse-code { |
| 146 |
position: relative; |
| 147 |
margin-top: 1em; |
| 148 |
margin-bottom: 1em; |
| 149 |
|
| 150 |
pre { |
| 151 |
margin-top: 0; |
| 152 |
margin-bottom: 0; |
| 153 |
} |
| 154 |
|
| 155 |
input{ |
| 156 |
display: none; |
| 157 |
|
| 158 |
~ .code-footer { |
| 159 |
width: 100%; |
| 160 |
margin: 0; |
| 161 |
padding: convert.px2em(4px) convert.px2em(8px) convert.px2em(4px) convert.px2em(0px); |
| 162 |
|
| 163 |
label { |
| 164 |
position: relative; |
| 165 |
margin: 0.05em; |
| 166 |
padding: 0.15em 0.8em; |
| 167 |
color: var(--md-primary-bg-color); |
| 168 |
font-size: 90%; |
| 169 |
background-color: var(--md-accent-fg-color); |
| 170 |
mask-repeat: no-repeat; |
| 171 |
mask-size: contain; |
| 172 |
border-radius: convert.px2rem(2px); |
| 173 |
cursor: pointer; |
| 174 |
content: ""; |
| 175 |
|
| 176 |
&:hover { |
| 177 |
background-color: var(--md-accent-fg-color); |
| 178 |
} |
| 179 |
|
| 180 |
&::before { |
| 181 |
position: absolute; |
| 182 |
top: 0.15em; |
| 183 |
left: 0.15em; |
| 184 |
display: block; |
| 185 |
box-sizing: border-box; |
| 186 |
width: 1.25em; |
| 187 |
height: 1.25em; |
| 188 |
background-color: var(--md-primary-bg-color); |
| 189 |
background-size: 1.25em; |
| 190 |
content: ""; |
| 191 |
} |
| 192 |
|
| 193 |
&.expand { |
| 194 |
display: none; |
| 195 |
|
| 196 |
&::before { |
| 197 |
mask-image: var(--highlight-svg-arrow-expand); |
| 198 |
} |
| 199 |
} |
| 200 |
&.collapse::before { |
| 201 |
mask-image: var(--highlight-svg-arrow-collapse); |
| 202 |
} |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
&:checked { |
| 207 |
~ .code-footer label.expand { |
| 208 |
display: inline; |
| 209 |
} |
| 210 |
|
| 211 |
~ .code-footer label.collapse { |
| 212 |
display: none; |
| 213 |
} |
| 214 |
|
| 215 |
+ div.highlight code { |
| 216 |
max-height: convert.px2em(150px); |
| 217 |
overflow: hidden; |
| 218 |
} |
| 219 |
|
| 220 |
~ .code-footer { |
| 221 |
position: relative; |
| 222 |
bottom: 4.3em; |
| 223 |
left: 0; |
| 224 |
margin-bottom: -4.3em; |
| 225 |
padding: convert.px2em(32px) convert.px2em(8px) convert.px2em(8px) convert.px2rem(16px); |
| 226 |
background-image: linear-gradient(to bottom, |
| 227 |
transparent, |
| 228 |
var(--md-default-bg-color) 80% |
| 229 |
100%); |
| 230 |
border-bottom-right-radius: convert.px2rem(9.6px); |
| 231 |
border-bottom-left-radius: convert.px2rem(9.6px); |
| 232 |
} |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
@include break.break-to-device(mobile) { |
| 239 |
.md-content__inner > { |
| 240 |
diagram-div { |
| 241 |
margin-right: convert.px2rem(-16px); |
| 242 |
margin-left: convert.px2rem(-16px); |
| 243 |
} |
| 244 |
.highlight span.filename { |
| 245 |
border-top-left-radius: 0; |
| 246 |
border-top-right-radius: 0; |
| 247 |
} |
| 248 |
.collapse-code { |
| 249 |
margin-right: convert.px2rem(-16px); |
| 250 |
margin-left: convert.px2rem(-16px); |
| 251 |
|
| 252 |
label.collapse { |
| 253 |
left: convert.px2rem(16px); |
| 254 |
} |
| 255 |
} |
| 256 |
} |
| 257 |
} |
| 258 |
|
| 259 |
.md-typeset .highlight+.result { |
| 260 |
border-right-width: convert.px2rem(2px); |
| 261 |
border-bottom-width: convert.px2rem(2px); |
| 262 |
border-left-width: convert.px2rem(2px); |
| 263 |
} |