mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-24 10:16:06 +03:00
feat: support lang in code block
This commit is contained in:
parent
d9d2a946a4
commit
e26eccd7fe
1 changed files with 4 additions and 1 deletions
|
@ -125,7 +125,10 @@ function treeToText(input: Node): string {
|
|||
pre = '\n'
|
||||
|
||||
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```'
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue