feat: support lang in code block
This commit is contained in:
parent
d9d2a946a4
commit
e26eccd7fe
|
@ -125,7 +125,10 @@ function treeToText(input: Node): string {
|
||||||
pre = '\n'
|
pre = '\n'
|
||||||
|
|
||||||
if (input.nodeName === 'code') {
|
if (input.nodeName === 'code') {
|
||||||
pre = '````\n'
|
const clz = input.attrs.find(attr => attr.name === 'class')
|
||||||
|
const lang = clz?.value.replace('language-', '')
|
||||||
|
|
||||||
|
pre = `\`\`\`${lang || ''}\n`
|
||||||
post = '\n```'
|
post = '\n```'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue