From e76df6fc8a98aa27fdc9b645fdb702c67e469c47 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 15 Mar 2024 16:35:30 +0800 Subject: [PATCH] feat: shiki add line number, fixes #309 Signed-off-by: Innei --- .../ui/code-highlighter/shiki/Shiki.module.css | 17 +++++++++++++++++ src/components/ui/modal/stacked/types.tsx | 3 --- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/ui/code-highlighter/shiki/Shiki.module.css b/src/components/ui/code-highlighter/shiki/Shiki.module.css index 550b3b1ba5..91652f0af6 100644 --- a/src/components/ui/code-highlighter/shiki/Shiki.module.css +++ b/src/components/ui/code-highlighter/shiki/Shiki.module.css @@ -11,6 +11,23 @@ @apply flex flex-col; } + code { + counter-reset: step; + counter-increment: step 0; + } + + code .line::before { + content: counter(step); + counter-increment: step; + width: 1.5rem; + margin: 0 6px; + display: inline-block; + text-align: right; + opacity: 0.3; + padding-right: 6px; + /* border-right: 1px solid currentColor; */ + } + .shiki, code { @apply !bg-transparent; diff --git a/src/components/ui/modal/stacked/types.tsx b/src/components/ui/modal/stacked/types.tsx index 7e33da9fcd..ff87b001e7 100644 --- a/src/components/ui/modal/stacked/types.tsx +++ b/src/components/ui/modal/stacked/types.tsx @@ -11,8 +11,5 @@ export interface ModalProps { max?: boolean - //// - sheetFullScreen?: boolean | 'half' - wrapper?: FC }