优化模版

This commit is contained in:
tianyaxiang 2025-01-31 13:25:45 +08:00
parent 069bef146a
commit 35177445af
2 changed files with 6 additions and 6 deletions

View File

@ -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'
@ -98,6 +99,7 @@ export const templates: Template[] = [
borderRadius: '4px'
},
link: {
fontSize: '15px',
color: '#576b95'
}
}

View File

@ -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)