code block line numbers

This commit is contained in:
Joshua Seigler 2025-07-10 23:50:28 -04:00
parent 2766453d75
commit 0226171b58
7 changed files with 159 additions and 99 deletions

View file

@ -96,15 +96,17 @@ a[href] {
margin: -0.1em;
position: relative;
}
a[target=_blank]::after {
display: inline-block;
content: "";
height: 1em;
width: 1em;
vertical-align: middle;
background-color: currentColor;
mask-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg viewBox='-2 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.267 3.793v7.996a.477.477 0 0 1-.475.475h-2.356v2.472a.476.476 0 0 1-.475.475H1.208a.476.476 0 0 1-.475-.475V6.74a.476.476 0 0 1 .475-.475h2.356V3.793a.476.476 0 0 1 .475-.475h9.753a.476.476 0 0 1 .475.475zm-3.94 8.471H4.04a.477.477 0 0 1-.475-.475V8.626H1.84v5.476h8.487zm2.832-6.585H4.672v5.476h8.487z'/%3E%3C/svg%3E");
opacity: 0.5;
@media screen {
a[target=_blank]::after {
display: inline-block;
content: "";
height: 1em;
width: 1em;
vertical-align: middle;
background-color: currentColor;
mask-image: var(--icon-copy);
opacity: 0.5;
}
}
a:hover,
a:focus-visible {
@ -127,6 +129,11 @@ a:focus-visible {
outline: 2px solid var(--c-text);
}
:root {
--icon-copy: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg viewBox='-2 0 19 19' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.267 3.793v7.996a.477.477 0 0 1-.475.475h-2.356v2.472a.476.476 0 0 1-.475.475H1.208a.476.476 0 0 1-.475-.475V6.74a.476.476 0 0 1 .475-.475h2.356V3.793a.476.476 0 0 1 .475-.475h9.753a.476.476 0 0 1 .475.475zm-3.94 8.471H4.04a.477.477 0 0 1-.475-.475V8.626H1.84v5.476h8.487zm2.832-6.585H4.672v5.476h8.487z'/%3E%3C/svg%3E");
--icon-rss: url("/icons/rss.svg");
}
main p img {
max-width: 100%;
}
@ -523,7 +530,7 @@ a.rss {
width: 1lh;
margin: 0 0 0 0.5rem;
--glowColor: #F80A;
background-image: url("/icons/rss.svg");
background-image: var(--icon-rss);
border-radius: 0.25em;
opacity: 0.25;
transition: 5s opacity;
@ -553,6 +560,10 @@ a.rss {
}
}
pre[class*="language-"] button {
display: none;
}
@media screen {
p:has(+ pre[class*="language-"]) > code:first-child:last-child {
position: relative;
@ -575,6 +586,25 @@ a.rss {
transparent
);
}
pre[class*="language-"] button {
display: block;
position: absolute;
top: 0;
right: 0;
border-radius: 0.5rem;
font-size: var(--s-1);
padding: 0.25em;
&::before {
content: "";
display: flex;
justify-content: center;
align-items: center;
width: 1lh;
height: 1lh;
background-color: currentColor;
mask-image: var(--icon-copy);
}
}
}
main {