优化模版
This commit is contained in:
parent
069bef146a
commit
35177445af
@ -52,8 +52,9 @@ export const templates: Template[] = [
|
|||||||
lineHeight: 1.2
|
lineHeight: 1.2
|
||||||
},
|
},
|
||||||
p: {
|
p: {
|
||||||
|
fontSize: '15px',
|
||||||
margin: '1.5em 8px',
|
margin: '1.5em 8px',
|
||||||
lineHeight: 1.75,
|
lineHeight: 2,
|
||||||
letterSpacing: '0.1em',
|
letterSpacing: '0.1em',
|
||||||
color: 'hsl(var(--foreground))',
|
color: 'hsl(var(--foreground))',
|
||||||
textAlign: 'justify'
|
textAlign: 'justify'
|
||||||
@ -98,6 +99,7 @@ export const templates: Template[] = [
|
|||||||
borderRadius: '4px'
|
borderRadius: '4px'
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
|
fontSize: '15px',
|
||||||
color: '#576b95'
|
color: '#576b95'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,6 @@ function baseStylesToString(base: RendererOptions['base'] = {}): string {
|
|||||||
if (base.primaryColor) {
|
if (base.primaryColor) {
|
||||||
styles.push(`--md-primary-color: ${base.primaryColor}`)
|
styles.push(`--md-primary-color: ${base.primaryColor}`)
|
||||||
}
|
}
|
||||||
if (base.textAlign) {
|
|
||||||
styles.push(`text-align: ${base.textAlign}`)
|
|
||||||
}
|
|
||||||
if (base.lineHeight) {
|
if (base.lineHeight) {
|
||||||
styles.push(`line-height: ${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) {
|
customRenderer.heading = function({ text, depth }: Tokens.Heading) {
|
||||||
const style = {
|
const style = {
|
||||||
...mergedOptions.block?.[`h${depth}`],
|
...mergedOptions.block?.[`h${depth}`],
|
||||||
color: mergedOptions.base?.themeColor // 使用主题颜色
|
color: mergedOptions.base?.themeColor, // 使用主题颜色
|
||||||
|
textAlign: mergedOptions.base?.textAlign // 添加文本对齐
|
||||||
}
|
}
|
||||||
const styleStr = cssPropertiesToString(style)
|
const styleStr = cssPropertiesToString(style)
|
||||||
const tokens = marked.Lexer.lexInline(text)
|
const tokens = marked.Lexer.lexInline(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user