From 6b8e81a8499ba5c48d5185d5ef3ae11d72908d0a Mon Sep 17 00:00:00 2001 From: tianyaxiang Date: Fri, 7 Mar 2025 16:50:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=8C=E5=86=85=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=B7=E5=BC=8F=E5=A4=9A``=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/globals.css | 20 ++++++++++++++++++++ src/lib/markdown/renderer.ts | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app/globals.css b/src/app/globals.css index 6a04c30..90a82fa 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -694,4 +694,24 @@ .scrollbar-none::-webkit-scrollbar { display: none; } +} + +/* 行内代码样式 */ +.inline-code::before, +.inline-code::after { + content: none !important; +} + +.inline-code { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 0.9em; + background: rgba(0, 0, 0, 0.05); + padding: 0.2em 0.4em; + border-radius: 3px; + margin: 0 0.2em; +} + +/* 暗色主题支持 */ +.dark .inline-code { + background: rgba(255, 255, 255, 0.1); } \ No newline at end of file diff --git a/src/lib/markdown/renderer.ts b/src/lib/markdown/renderer.ts index 2393a59..1c6c0e4 100644 --- a/src/lib/markdown/renderer.ts +++ b/src/lib/markdown/renderer.ts @@ -224,7 +224,7 @@ export class MarkdownRenderer { this.renderer.codespan = ({ text }: Tokens.Codespan) => { const codespanStyle = (this.options.inline?.codespan || {}) const styleStr = cssPropertiesToString(codespanStyle) - return `${text}` + return `${text}` } // 重写 em 方法