feat: add codeblock style

This commit is contained in:
Keisuke Hirata 2024-09-07 02:38:47 +09:00
parent 0512b64ce4
commit 68dde60151

View File

@ -1,30 +1,34 @@
.document { .document {
--color-text: #ffffff; --color-text: #ffffff;
--color-concept: hsl(39, 100%, 25%, 0.5); --color-concept: hsla(40, 100%, 90%, 0.5);
--color-concept-hsl: 39, 100%, 25%; --color-concept-hsl: 39, 100%, 25%;
--color-outline: #ffffff40; --color-outline: #ffffff40;
width: 100%; width: 100%;
* {
color: var(--color-text); color: var(--color-text);
}
h1 { h1 {
position: relative; position: relative;
width: auto; width: auto;
font-size: 2rem; font-size: 2rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
hr { hr {
padding: 0; padding: 0;
margin: 0; margin: 0;
border: none; border: none;
border-top: 1px solid var(--color-outline); border-top: 1px solid var(--color-outline);
} }
> *:not(h1, hr) {
>*:not(h1, hr) {
margin-left: 2rem; margin-left: 2rem;
} }
h2 { h2 {
font-size: 1.5rem; font-size: 1.5rem;
position: relative; position: relative;
&::before { &::before {
content: '#'; content: '#';
position: absolute; position: absolute;
@ -34,30 +38,38 @@
color: rgb(131, 131, 131); color: rgb(131, 131, 131);
} }
} }
h3 { h3 {
font-size: 1.25rem; font-size: 1.25rem;
} }
h4 { h4 {
font-size: 1.05rem; font-size: 1.05rem;
} }
hr { hr {
border: none; border: none;
border-top: 1px solid var(--color-outline); border-top: 1px solid var(--color-outline);
} }
img { img {
max-height: 300px; max-height: 300px;
} }
a { a {
color: var(--color-text);
position: relative; position: relative;
display: inline-block; display: inline-block;
transform: translate(0, 0); transform: translate(0, 0);
text-shadow: 0 0 1rem hsl(var(--color-concept-hsl)); text-shadow: 0 0 1rem hsl(var(--color-concept-hsl));
transition: 0.2s ease-out; transition: 0.2s ease-out;
font-weight: normal; font-weight: normal;
&:hover { &:hover {
transform: translate(0, -0.1rem); transform: translate(0, -0.1rem);
} }
} }
blockquote { blockquote {
position: relative; position: relative;
font-size: 1.1rem; font-size: 1.1rem;
@ -65,6 +77,7 @@
padding: 0; padding: 0;
padding-left: 1rem; padding-left: 1rem;
color: rgb(162, 162, 162); color: rgb(162, 162, 162);
&::before { &::before {
content: ''; content: '';
position: absolute; position: absolute;
@ -74,6 +87,7 @@
color: rgb(131, 131, 131); color: rgb(131, 131, 131);
} }
} }
warn { warn {
position: relative; position: relative;
display: block; display: block;
@ -81,9 +95,10 @@
background-image: linear-gradient(to right, var(--color-outline), transparent 75%); background-image: linear-gradient(to right, var(--color-outline), transparent 75%);
background-origin: border-box; background-origin: border-box;
box-shadow: inset 0 0 0 100vh var(--background-color); box-shadow: inset 0 0 0 100vh var(--background-color);
text-shadow: 0 0 1rem hsl(var(--color-concept-hsl),1); text-shadow: 0 0 1rem hsl(var(--color-concept-hsl), 1);
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 0.5rem; border-radius: 0.5rem;
&::before { &::before {
content: 'note:warn'; content: 'note:warn';
position: relative; position: relative;
@ -95,19 +110,42 @@
text-shadow: 0 0 1rem red; text-shadow: 0 0 1rem red;
} }
} }
pre { pre {
font-family: monospace; font-family: monospace;
position: relative;
display: block;
margin-top: 0.75rem; margin-top: 0.75rem;
margin-bottom: 0.75rem; margin-bottom: 0.75rem;
white-space: pre-wrap; border: 2px solid #ffffff40;
border-radius: 0.5rem;
overflow-x: scroll;
&::-webkit-scrollbar {
border-radius: 10px;
height: 10px;
width: 8px;
} }
code {
&::-webkit-scrollbar-thumb {
background: #999;
border-radius: 10px;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
}
>code {
display: inline-block; display: inline-block;
padding: 0.2rem; padding: 0.5rem;
background: rgba(255, 255, 255, 0.25); border-radius: 0.6rem;
border-radius: 0.2rem;
font-family: monospace; font-family: monospace;
box-sizing: border-box;
min-width: 100%;
} }
}
details { details {
position: relative; position: relative;
display: block; display: block;
@ -115,7 +153,8 @@
transition: 0.2s ease-out; transition: 0.2s ease-out;
transition-property: height; transition-property: height;
padding-inline-start: 0.1rem; padding-inline-start: 0.1rem;
> summary {
>summary {
position: relative; position: relative;
border-radius: 0.5rem; border-radius: 0.5rem;
list-style: ' ' outside; list-style: ' ' outside;
@ -123,36 +162,43 @@
padding: 0.2rem; padding: 0.2rem;
background: linear-gradient(to right, rgba(255, 255, 255, 0.25), transparent 200px); background: linear-gradient(to right, rgba(255, 255, 255, 0.25), transparent 200px);
cursor: pointer; cursor: pointer;
&:hover { &:hover {
text-shadow: 0 0 0.25rem rgb(255, 255, 255); text-shadow: 0 0 0.25rem rgb(255, 255, 255);
} }
} }
> p {
>p {
margin-block-start: 0.5rem; margin-block-start: 0.5rem;
margin-block-end: 0.5rem; margin-block-end: 0.5rem;
margin-left: 1rem; margin-left: 1rem;
display: none; display: none;
} }
&[open] { &[open] {
> summary { >summary {
list-style: ' ' outside; list-style: ' ' outside;
} }
> p {
>p {
animation: detailsIn 0.5s ease; animation: detailsIn 0.5s ease;
display: block; display: block;
} }
} }
} }
@keyframes detailsIn { @keyframes detailsIn {
0% { 0% {
opacity: 0; opacity: 0;
transform: translateY(-10px); transform: translateY(-10px);
} }
100% { 100% {
opacity: 1; opacity: 1;
transform: none; transform: none;
} }
} }
table { table {
border-spacing: 0; border-spacing: 0;
border: none; border: none;
@ -160,19 +206,23 @@
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
box-shadow: 0 0 0.5rem hsl(var(--color-concept-hsl), 0.5); box-shadow: 0 0 0.5rem hsl(var(--color-concept-hsl), 0.5);
thead { thead {
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
color: #fff; color: #fff;
} }
tr { tr {
&:nth-child(2n) { &:nth-child(2n) {
background-color: #ffffff0d; background-color: #ffffff0d;
} }
} }
td, td,
th { th {
padding: 0.5em; padding: 0.5em;
border-left: 1px solid var(--color-outline); border-left: 1px solid var(--color-outline);
&:first-child { &:first-child {
border-left: none; border-left: none;
} }