feat: add line numbers for code blocks

This commit is contained in:
saicaca 2024-01-25 16:09:00 +08:00
parent d831f4f5ca
commit 8b8a765d56
1 changed files with 10 additions and 1 deletions

View File

@ -61,10 +61,20 @@ const className = Astro.props.class;
padding: 0.125rem 0.25rem padding: 0.125rem 0.25rem
border-radius: 0.25rem border-radius: 0.25rem
overflow: hidden overflow: hidden
counter-reset: line
&:before &:before
content: none content: none
&:after &:after
content: none content: none
span.line
&:before
content: counter(line)
counter-increment: line
direction: rtl
display: inline-block
margin-right: 1rem
width: 1.375rem
color: rgba(255, 255, 255, 0.25)
pre pre
background: var(--codeblock-bg) !important background: var(--codeblock-bg) !important
border-radius: 0.75rem border-radius: 0.75rem
@ -127,7 +137,6 @@ const className = Astro.props.class;
@layer components { @layer components {
.custom-md h1 { .custom-md h1 {
@apply text-3xl @apply text-3xl
} }
} }