优化bug

This commit is contained in:
tianyaxiang 2025-02-02 15:24:50 +08:00
parent 63d8ef5897
commit c3456dea16

View File

@ -334,9 +334,7 @@ export function convertToWechat(markdown: string, options: RendererOptions = def
...linkStyle
}
const styleStr = cssPropertiesToString(style)
const tokens = marked.Lexer.lexInline(text)
const content = marked.Parser.parseInline(tokens, { renderer })
return `<a href="${href}"${title ? ` title="${title}"` : ''}${styleStr ? ` style="${styleStr}"` : ''}>${content}</a>`
return `<a href="${href}"${title ? ` title="${title}"` : ''}${styleStr ? ` style="${styleStr}"` : ''}>${text}</a>`
}
// 重写 image 方法
@ -409,8 +407,6 @@ export function convertToWechat(markdown: string, options: RendererOptions = def
return `<li${styleStr ? ` style="${styleStr}"` : ''}>${content}</li>`
}
// 添加删除线支持
renderer.del = function({ text }: Tokens.Del) {
const delStyle = (mergedOptions.inline?.del || {}) as StyleOptions