From d5d594fb7f25cb046a57fb8770b99bf465d47800 Mon Sep 17 00:00:00 2001 From: cfq Date: Mon, 26 Jan 2026 18:25:33 +0800 Subject: [PATCH] =?UTF-8?q?style(=E7=BC=96=E8=BE=91=E5=99=A8):=20=E4=B8=BA?= =?UTF-8?q?=E8=A1=8C=E5=86=85=E4=BB=A3=E7=A0=81=E6=B7=BB=E5=8A=A0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=B9=B6=E7=A7=BB=E9=99=A4=E6=96=87=E6=9C=AC=E8=A3=85?= =?UTF-8?q?=E9=A5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为行内代码添加等宽字体、背景色和圆角样式,提升可读性 - 移除 CodeMirror 特定元素下的文本装饰线,保持界面整洁 --- src/codemirror/liveMarkdownDecorations.js | 9 +++++++++ src/components/LivePreviewEditor.vue | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/codemirror/liveMarkdownDecorations.js b/src/codemirror/liveMarkdownDecorations.js index 931d182..181aecc 100644 --- a/src/codemirror/liveMarkdownDecorations.js +++ b/src/codemirror/liveMarkdownDecorations.js @@ -367,6 +367,15 @@ const buildDecorations = (view, filePath) => { value: Decoration.mark({ class: 'cm-md-code-info' }) }) } + + // 5.3 行内代码 (InlineCode) + if (typeName === 'InlineCode') { + decorations.push({ + from: nodeFrom, + to: nodeTo, + value: Decoration.mark({ class: 'cm-md-monospace' }) + }) + } // 6. 链接 (Link) -> LinkMark, URL, LinkTitle... // 结构通常是: Link( [ LinkMark( [ ) ... LinkMark( ] ) LinkMark( ( ) URL ... LinkMark( ) ) ] ) diff --git a/src/components/LivePreviewEditor.vue b/src/components/LivePreviewEditor.vue index bd306a4..b728cc0 100644 --- a/src/components/LivePreviewEditor.vue +++ b/src/components/LivePreviewEditor.vue @@ -134,6 +134,15 @@ const liveEditorTheme = computed(() => { paddingLeft: '4px' }, + // 行内代码样式 + '.cm-md-monospace': { + fontFamily: monospaceFont, + backgroundColor: 'var(--hover-background)', + padding: '2px 4px', + borderRadius: '4px', + fontSize: '0.9em' + }, + // 代码块样式 '.cm-line.cm-md-fenced-code': { fontFamily: monospaceFont, @@ -284,4 +293,8 @@ onUnmounted(() => { overflow: hidden; background: var(--card-background); } + +:deep(.ͼ7) { + text-decoration: none; +}