From 35177445af4ecb04128ea421894e264c35780611 Mon Sep 17 00:00:00 2001 From: tianyaxiang Date: Fri, 31 Jan 2025 13:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/wechat-templates.ts | 6 ++++-- src/lib/markdown.ts | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config/wechat-templates.ts b/src/config/wechat-templates.ts index df380fe..f0d565e 100644 --- a/src/config/wechat-templates.ts +++ b/src/config/wechat-templates.ts @@ -52,8 +52,9 @@ export const templates: Template[] = [ lineHeight: 1.2 }, p: { + fontSize: '15px', margin: '1.5em 8px', - lineHeight: 1.75, + lineHeight: 2, letterSpacing: '0.1em', color: 'hsl(var(--foreground))', textAlign: 'justify' @@ -97,7 +98,8 @@ export const templates: Template[] = [ padding: '3px 5px', borderRadius: '4px' }, - link: { + link: { + fontSize: '15px', color: '#576b95' } } diff --git a/src/lib/markdown.ts b/src/lib/markdown.ts index 197fbf7..68c4131 100644 --- a/src/lib/markdown.ts +++ b/src/lib/markdown.ts @@ -21,9 +21,6 @@ function baseStylesToString(base: RendererOptions['base'] = {}): string { if (base.primaryColor) { styles.push(`--md-primary-color: ${base.primaryColor}`) } - if (base.textAlign) { - styles.push(`text-align: ${base.textAlign}`) - } if (base.lineHeight) { styles.push(`line-height: ${base.lineHeight}`) } @@ -103,7 +100,8 @@ export function convertToWechat(markdown: string, options: RendererOptions = def customRenderer.heading = function({ text, depth }: Tokens.Heading) { const style = { ...mergedOptions.block?.[`h${depth}`], - color: mergedOptions.base?.themeColor // 使用主题颜色 + color: mergedOptions.base?.themeColor, // 使用主题颜色 + textAlign: mergedOptions.base?.textAlign // 添加文本对齐 } const styleStr = cssPropertiesToString(style) const tokens = marked.Lexer.lexInline(text)