code block line numbers
This commit is contained in:
parent
2766453d75
commit
0226171b58
7 changed files with 159 additions and 99 deletions
|
@ -7,8 +7,7 @@ pre[class*="language-"] {
|
|||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.5em;
|
||||
color: var(--c-text-dim);
|
||||
line-height: 1.4;
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
@ -20,16 +19,49 @@ pre[class*="language-"] {
|
|||
:not(pre) > code[class*="language-"] {
|
||||
background: var(--c-text-background-light);
|
||||
white-space: normal;
|
||||
border-radius: 0.2em;
|
||||
border-radius: 0.2rem;
|
||||
padding: 0.1em;
|
||||
}
|
||||
pre[class*="language-"] {
|
||||
background: color-mix(in lch, var(--c-text-background-light) 20%, transparent);
|
||||
overflow: auto;
|
||||
> code {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
position: relative;
|
||||
margin: 0.5em 0;
|
||||
padding: 1.25em 1em;
|
||||
padding: 0.5em 1em 0.5em calc(var(--lineNumWidth) + 0.25rem);
|
||||
box-shadow: inset 0 0 6rem -2rem var(--c-highlight);
|
||||
counter-reset: lineNumber;
|
||||
--places: 1;
|
||||
&:has(.highlight-line:nth-child(10)) { --places: 2 }
|
||||
&:has(.highlight-line:nth-child(100)) { --places: 3 }
|
||||
&:has(.highlight-line:nth-child(1000)) { --places: 4 }
|
||||
--lineNumWidth: calc(1em + var(--places) * 1ch);
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: var(--lineNumWidth);
|
||||
width: 3rem;
|
||||
opacity: 0.125;
|
||||
z-index: -1;
|
||||
background: linear-gradient(to right, var(--c-highlight), transparent);
|
||||
border-radius: 0.5em;
|
||||
}
|
||||
.highlight-line {
|
||||
position: relative;
|
||||
}
|
||||
.highlight-line::before {
|
||||
content: counter(lineNumber);
|
||||
counter-increment: lineNumber;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: calc(100% + 0.5em);
|
||||
color: var(--c-highlight);
|
||||
word-break: normal;
|
||||
}
|
||||
}
|
||||
p:has(+ pre[class*="language-"]) > code {
|
||||
margin: 0;
|
||||
|
@ -46,44 +78,47 @@ p:has(>code) + pre[class*="language-"] {
|
|||
.token.id { font-weight: bold; }
|
||||
.token.important { font-weight: bold; }
|
||||
|
||||
.language-css > code,
|
||||
.language-sass > code,
|
||||
.language-scss > code {
|
||||
color: #fd9170;
|
||||
@media screen {
|
||||
pre[class*="language-"] { color: var(--c-text-dim); }
|
||||
.language-css > code,
|
||||
.language-sass > code,
|
||||
.language-scss > code {
|
||||
color: #fd9170;
|
||||
}
|
||||
.token.atrule { color: #c792ea; }
|
||||
.token.attr-name { color: #ffcb6b; }
|
||||
.token.attr-value { color: #a5e844; }
|
||||
.token.attribute { color: #a5e844; }
|
||||
.token.boolean { color: #c792ea; }
|
||||
.token.builtin { color: #ffcb6b; }
|
||||
.token.cdata { color: #80cbc4; }
|
||||
.token.char { color: #80cbc4; }
|
||||
.token.class { color: #ffcb6b; }
|
||||
.token.class-name { color: #f2ff00; }
|
||||
.token.comment { color: #616161; }
|
||||
.token.constant { color: #c792ea; }
|
||||
.token.deleted { color: #ff6666; }
|
||||
.token.doctype { color: #616161; }
|
||||
.token.entity { color: #ff6666; }
|
||||
.token.function { color: #c792ea; }
|
||||
.token.hexcode { color: #f2ff00; }
|
||||
.token.id { color: #c792ea; }
|
||||
.token.important { color: #c792ea; }
|
||||
.token.inserted { color: #80cbc4; }
|
||||
.token.keyword { color: #c792ea; }
|
||||
.token.number { color: #fd9170; }
|
||||
.token.operator { color: #89ddff; }
|
||||
.token.prolog { color: #616161; }
|
||||
.token.property { color: #80cbc4; }
|
||||
.token.pseudo-class { color: #a5e844; }
|
||||
.token.pseudo-element { color: #a5e844; }
|
||||
.token.punctuation { color: #89ddff; }
|
||||
.token.regex { color: #f2ff00; }
|
||||
.token.selector { color: #ff6666; }
|
||||
.token.string { color: #a5e844; }
|
||||
.token.symbol { color: #c792ea; }
|
||||
.token.tag { color: #ff6666; }
|
||||
.token.unit { color: #fd9170; }
|
||||
.token.url { color: #ff6666; }
|
||||
.token.variable { color: #ff6666; }
|
||||
}
|
||||
.token.atrule { color: #c792ea; }
|
||||
.token.attr-name { color: #ffcb6b; }
|
||||
.token.attr-value { color: #a5e844; }
|
||||
.token.attribute { color: #a5e844; }
|
||||
.token.boolean { color: #c792ea; }
|
||||
.token.builtin { color: #ffcb6b; }
|
||||
.token.cdata { color: #80cbc4; }
|
||||
.token.char { color: #80cbc4; }
|
||||
.token.class { color: #ffcb6b; }
|
||||
.token.class-name { color: #f2ff00; }
|
||||
.token.comment { color: #616161; }
|
||||
.token.constant { color: #c792ea; }
|
||||
.token.deleted { color: #ff6666; }
|
||||
.token.doctype { color: #616161; }
|
||||
.token.entity { color: #ff6666; }
|
||||
.token.function { color: #c792ea; }
|
||||
.token.hexcode { color: #f2ff00; }
|
||||
.token.id { color: #c792ea; }
|
||||
.token.important { color: #c792ea; }
|
||||
.token.inserted { color: #80cbc4; }
|
||||
.token.keyword { color: #c792ea; }
|
||||
.token.number { color: #fd9170; }
|
||||
.token.operator { color: #89ddff; }
|
||||
.token.prolog { color: #616161; }
|
||||
.token.property { color: #80cbc4; }
|
||||
.token.pseudo-class { color: #a5e844; }
|
||||
.token.pseudo-element { color: #a5e844; }
|
||||
.token.punctuation { color: #89ddff; }
|
||||
.token.regex { color: #f2ff00; }
|
||||
.token.selector { color: #ff6666; }
|
||||
.token.string { color: #a5e844; }
|
||||
.token.symbol { color: #c792ea; }
|
||||
.token.tag { color: #ff6666; }
|
||||
.token.unit { color: #fd9170; }
|
||||
.token.url { color: #ff6666; }
|
||||
.token.variable { color: #ff6666; }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -33,14 +33,14 @@ Here is the Caddyfile I made---you will need to change the domain names and the
|
|||
```caddy
|
||||
# Global options block
|
||||
{
|
||||
email you@example.com # <<<< CHANGE THIS <<<<
|
||||
email you@example.com #### CHANGE THIS ####
|
||||
on_demand_tls {
|
||||
ask http://localhost/check
|
||||
}
|
||||
}
|
||||
|
||||
# Webhooks
|
||||
https://webhooks.subdomain.here.tld { <<<< CHANGE THIS <<<<
|
||||
https://webhooks.subdomain.here.tld { #### CHANGE THIS ####
|
||||
reverse_proxy localhost:9000
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue