mirror of
https://github.com/doocs/md.git
synced 2025-01-22 20:04:39 +08:00
parent
03b0e73acb
commit
23de6453a3
@ -174,6 +174,8 @@ export function initRenderer(opts: IOpts) {
|
||||
const langText = lang.split(` `)[0]
|
||||
const language = hljs.getLanguage(langText) ? langText : `plaintext`
|
||||
let highlighted = hljs.highlight(text, { language }).value
|
||||
// tab to 4 spaces
|
||||
highlighted = highlighted.replace(/\t/g, ' ')
|
||||
highlighted = highlighted
|
||||
.replace(/\r\n/g, `<br/>`)
|
||||
.replace(/\n/g, `<br/>`)
|
||||
|
Loading…
Reference in New Issue
Block a user