优化模版

This commit is contained in:
tianyaxiang 2025-01-30 17:50:41 +08:00
parent a3c021561c
commit 863ff4b1f1
2 changed files with 13 additions and 2 deletions

View File

@ -52,8 +52,8 @@ export const templates: Template[] = [
lineHeight: 1.2 lineHeight: 1.2
}, },
p: { p: {
fontSize:'12px',
margin: '1.5em 8px', margin: '1.5em 8px',
lineHeight: 1.75,
letterSpacing: '0.1em', letterSpacing: '0.1em',
color: 'hsl(var(--foreground))', color: 'hsl(var(--foreground))',
textAlign: 'justify' textAlign: 'justify'
@ -136,6 +136,15 @@ export const templates: Template[] = [
textAlign: 'center', textAlign: 'center',
borderRadius: '4px' borderRadius: '4px'
}, },
h3: {
paddingLeft: '8px',
borderLeft: '3px solid var(--md-primary-color)',
margin: '2em 8px 0.75em 0',
color: 'hsl(var(--foreground))',
fontSize: '1.1em',
fontWeight: 'bold',
lineHeight: 1.2
},
p: { p: {
margin: '1.8em 8px', margin: '1.8em 8px',
letterSpacing: '0.12em', letterSpacing: '0.12em',
@ -170,7 +179,8 @@ export const templates: Template[] = [
base: { base: {
primaryColor: '#4299e1', primaryColor: '#4299e1',
textAlign: 'left', textAlign: 'left',
lineHeight: '1.8' lineHeight: '1.8',
fontSize: '50px'
}, },
block: { block: {
h1: { h1: {

View File

@ -113,6 +113,7 @@ export function convertToWechat(markdown: string, options: RendererOptions = def
customRenderer.paragraph = function({ text }: Tokens.Paragraph) { customRenderer.paragraph = function({ text }: Tokens.Paragraph) {
const style = mergedOptions.block?.p const style = mergedOptions.block?.p
const styleStr = cssPropertiesToString(style) const styleStr = cssPropertiesToString(style)
const tokens = marked.Lexer.lexInline(text) const tokens = marked.Lexer.lexInline(text)
const content = marked.Parser.parseInline(tokens, { renderer: customRenderer }) const content = marked.Parser.parseInline(tokens, { renderer: customRenderer })