From 54ea0b97a90e8dff68197fd80537dd1fda1b2e2b Mon Sep 17 00:00:00 2001 From: tianyaxiang Date: Fri, 31 Jan 2025 14:14:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A8=A1=E7=89=88=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/wechat-templates.ts | 36 ++++++++++++++++++++++++++++++++++ src/lib/markdown.ts | 6 ++++++ 2 files changed, 42 insertions(+) diff --git a/src/config/wechat-templates.ts b/src/config/wechat-templates.ts index 5806a8a..dbbb2b1 100644 --- a/src/config/wechat-templates.ts +++ b/src/config/wechat-templates.ts @@ -82,6 +82,30 @@ export const templates: Template[] = [ padding: '1em', lineHeight: 1.5, margin: '10px 8px', + background: '#f6f8fa', + border: '1px solid #e5e7eb', + fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace', + }, + code: { + fontSize: '90%', + background: 'rgba(27,31,35,.05)', + padding: '3px 5px', + borderRadius: '4px', + fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace' + }, + ul: { + listStyle: 'disc', + paddingLeft: '2em', + margin: '1em 0', + color: 'rgba(0, 0, 0, 0.3)', + fontSize: '15px' + }, + ol: { + listStyle: 'decimal', + paddingLeft: '2em', + margin: '1em 0', + color: 'hsl(var(--foreground))', + lineHeight: 1.75 }, image: { display: 'block', @@ -108,6 +132,11 @@ export const templates: Template[] = [ link: { fontSize: '15px', color: '#576b95' + }, + listitem: { + margin: '0.5em 0', + lineHeight: 1.75, + color: 'hsl(var(--foreground))' } }, dark: { @@ -119,6 +148,8 @@ export const templates: Template[] = [ h2: { color: 'hsl(var(--foreground))' }, h3: { color: 'hsl(var(--foreground))' }, p: { color: 'hsl(var(--foreground))' }, + ul: { color: 'hsl(var(--foreground))' }, + ol: { color: 'hsl(var(--foreground))' }, pre: { background: 'hsl(var(--muted))', border: '1px solid hsl(var(--border))' @@ -127,6 +158,11 @@ export const templates: Template[] = [ background: 'hsl(var(--muted))', color: 'hsl(var(--accent-foreground))' }, + code_pre: { + background: 'hsl(var(--muted))', + border: '1px solid hsl(var(--border))', + color: 'hsl(var(--foreground))' + }, blockquote: { background: 'hsl(var(--muted))', borderLeftColor: 'hsl(var(--primary))', diff --git a/src/lib/markdown.ts b/src/lib/markdown.ts index 90b4c8c..a407b9d 100644 --- a/src/lib/markdown.ts +++ b/src/lib/markdown.ts @@ -263,6 +263,12 @@ export interface StyleOptions { fontFamily?: string WebkitBackgroundClip?: string WebkitTextFillColor?: string + listStyle?: string + '@media (max-width: 768px)'?: { + margin?: string + padding?: string + fontSize?: string + } } export interface RendererOptions {