优化移动设备体验
This commit is contained in:
parent
6f0ac58505
commit
cdca9d4d3f
@ -74,7 +74,9 @@ export function convertToWechat(markdown: string, options: RendererOptions = {})
|
|||||||
customRenderer.heading = function({ text, depth }: Tokens.Heading) {
|
customRenderer.heading = function({ text, depth }: Tokens.Heading) {
|
||||||
const style = options.block?.[`h${depth}` as keyof typeof options.block]
|
const style = options.block?.[`h${depth}` as keyof typeof options.block]
|
||||||
const styleStr = cssPropertiesToString(style)
|
const styleStr = cssPropertiesToString(style)
|
||||||
return `<h${depth}${styleStr ? ` style="${styleStr}"` : ''}>${text}</h${depth}>`
|
const tokens = marked.Lexer.lexInline(text)
|
||||||
|
const content = marked.Parser.parseInline(tokens, { renderer: customRenderer })
|
||||||
|
return `<h${depth}${styleStr ? ` style="${styleStr}"` : ''}>${content}</h${depth}>`
|
||||||
}
|
}
|
||||||
|
|
||||||
customRenderer.paragraph = function({ text }: Tokens.Paragraph) {
|
customRenderer.paragraph = function({ text }: Tokens.Paragraph) {
|
||||||
|
Loading…
Reference in New Issue
Block a user