|
|
|
|
|
|
|
|
|
|
|
code { |
|
|
font-size: 14px; |
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; |
|
|
background-color: var(--code-bg); |
|
|
border-radius: 0.3em; |
|
|
border: 1px solid var(--border-color); |
|
|
color: var(--text-color); |
|
|
font-weight: 400; |
|
|
line-height: 1.5; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.astro-code { |
|
|
position: relative; |
|
|
border: 1px solid var(--border-color); |
|
|
border-radius: 6px; |
|
|
padding: 0; |
|
|
font-size: 14px; |
|
|
--code-gutter-width: 2.5em; |
|
|
} |
|
|
|
|
|
|
|
|
.astro-code, |
|
|
section.content-grid pre { |
|
|
overflow-x: auto; |
|
|
width: 100%; |
|
|
max-width: 100%; |
|
|
box-sizing: border-box; |
|
|
-webkit-overflow-scrolling: touch; |
|
|
padding: 0; |
|
|
} |
|
|
|
|
|
|
|
|
.astro-code, |
|
|
section.content-grid pre { |
|
|
margin: 0 0 var(--block-spacing-y); |
|
|
} |
|
|
|
|
|
section.content-grid pre { margin: 0; } |
|
|
|
|
|
section.content-grid pre code { |
|
|
display: inline-block; |
|
|
min-width: 100%; |
|
|
} |
|
|
|
|
|
|
|
|
@media (--bp-content-collapse) { |
|
|
.astro-code, |
|
|
section.content-grid pre { |
|
|
white-space: pre-wrap; |
|
|
overflow-wrap: anywhere; |
|
|
word-break: break-word; |
|
|
} |
|
|
|
|
|
section.content-grid pre code { |
|
|
white-space: pre-wrap; |
|
|
display: block; |
|
|
min-width: 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[data-theme='light'] .astro-code { background-color: var(--code-bg); } |
|
|
|
|
|
|
|
|
[data-theme='light'] .astro-code span { color: var(--shiki-light) !important; } |
|
|
[data-theme='dark'] .astro-code span { color: var(--shiki-dark) !important; } |
|
|
|
|
|
|
|
|
[data-theme='light'] .astro-code { |
|
|
--shiki-foreground: #24292f; |
|
|
--shiki-background: #ffffff; |
|
|
} |
|
|
|
|
|
|
|
|
.astro-code code { |
|
|
counter-reset: astro-code-line; |
|
|
display: block; |
|
|
background: none; |
|
|
border: none; |
|
|
} |
|
|
|
|
|
.astro-code .line { |
|
|
display: inline-block; |
|
|
position: relative; |
|
|
padding-left: calc(var(--code-gutter-width) + var(--spacing-1)); |
|
|
min-height: 1.25em; |
|
|
} |
|
|
|
|
|
.astro-code .line::before { |
|
|
counter-increment: astro-code-line; |
|
|
content: counter(astro-code-line); |
|
|
position: absolute; |
|
|
left: 0; |
|
|
top: 0; |
|
|
bottom: 0; |
|
|
width: calc(var(--code-gutter-width)); |
|
|
text-align: right; |
|
|
color: var(--muted-color); |
|
|
opacity: .3; |
|
|
user-select: none; |
|
|
padding-right: var(--spacing-2); |
|
|
border-right: 1px solid var(--border-color); |
|
|
} |
|
|
|
|
|
.astro-code .line:empty::after { content: "\00a0"; } |
|
|
|
|
|
|
|
|
.astro-code code > .line:last-child:empty { display: none; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.code-card { position: relative; } |
|
|
|
|
|
.code-card .code-copy { |
|
|
position: absolute; |
|
|
top: 6px; |
|
|
right: 6px; |
|
|
z-index: 3; |
|
|
padding: 6px 12px; |
|
|
border: none; |
|
|
} |
|
|
|
|
|
.code-card .code-copy svg { |
|
|
width: 16px; |
|
|
height: 16px; |
|
|
display: block; |
|
|
fill: currentColor; |
|
|
} |
|
|
|
|
|
.code-card pre { margin: 0 0 var(--spacing-1); } |
|
|
|
|
|
|
|
|
.code-card::after { |
|
|
content: attr(data-language); |
|
|
position: absolute; |
|
|
top: 8px; |
|
|
right: 56px; |
|
|
font-size: 10px; |
|
|
line-height: 1; |
|
|
text-transform: uppercase; |
|
|
color: var(--muted-color); |
|
|
pointer-events: none; |
|
|
z-index: 2; |
|
|
} |
|
|
|
|
|
|
|
|
.code-card.no-copy::after { top: 8px; right: 8px; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.accordion .astro-code { padding: 0; border: none; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.astro-code::after { |
|
|
content: attr(data-language); |
|
|
position: sticky; |
|
|
right: 0; |
|
|
bottom: 0; |
|
|
font-size: 10px; |
|
|
line-height: 1; |
|
|
text-transform: uppercase; |
|
|
color: var(--muted-color); |
|
|
background: var(--surface-bg); |
|
|
border-top: 1px solid var(--border-color); |
|
|
border-left: 1px solid var(--border-color); |
|
|
opacity: 1; |
|
|
border-radius: 8px 0 0 0; |
|
|
padding: 4px 6px; |
|
|
pointer-events: none; |
|
|
} |
|
|
|
|
|
|
|
|
.astro-code[data-lang]::after { content: attr(data-lang); } |
|
|
|
|
|
|
|
|
.astro-code[data-language="typescript"]::after { content: "ts"; } |
|
|
.astro-code[data-language="tsx"]::after { content: "tsx"; } |
|
|
.astro-code[data-language="javascript"]::after, |
|
|
.astro-code[data-language="node"]::after, |
|
|
.astro-code[data-language="jsx"]::after { content: "js"; } |
|
|
.astro-code[data-language="python"]::after { content: "py"; } |
|
|
.astro-code[data-language="bash"]::after, |
|
|
.astro-code[data-language="shell"]::after, |
|
|
.astro-code[data-language="sh"]::after { content: "sh"; } |
|
|
.astro-code[data-language="markdown"]::after { content: "md"; } |
|
|
.astro-code[data-language="yaml"]::after, |
|
|
.astro-code[data-language="yml"]::after { content: "yml"; } |
|
|
.astro-code[data-language="html"]::after { content: "html"; } |
|
|
.astro-code[data-language="css"]::after { content: "css"; } |
|
|
.astro-code[data-language="json"]::after { content: "json"; } |
|
|
|
|
|
|
|
|
.accordion .astro-code::after { right: 0; bottom: 0; } |
|
|
|