From 8b8a765d56e0c9675b64b35b58a688540737b883 Mon Sep 17 00:00:00 2001 From: saicaca Date: Thu, 25 Jan 2024 16:09:00 +0800 Subject: [PATCH] feat: add line numbers for code blocks --- src/components/misc/Markdown.astro | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/misc/Markdown.astro b/src/components/misc/Markdown.astro index 39dd49b..4b0021d 100644 --- a/src/components/misc/Markdown.astro +++ b/src/components/misc/Markdown.astro @@ -61,10 +61,20 @@ const className = Astro.props.class; padding: 0.125rem 0.25rem border-radius: 0.25rem overflow: hidden + counter-reset: line &:before content: none &:after 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 background: var(--codeblock-bg) !important border-radius: 0.75rem @@ -127,7 +137,6 @@ const className = Astro.props.class; @layer components { .custom-md h1 { @apply text-3xl - } }