Skip to content

Commit 23de645

Browse files
authored
fix: render tab to spaces (doocs#498)
doocs#497
1 parent 03b0e73 commit 23de645

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/utils/renderer.ts

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ export function initRenderer(opts: IOpts) {
174174
const langText = lang.split(` `)[0]
175175
const language = hljs.getLanguage(langText) ? langText : `plaintext`
176176
let highlighted = hljs.highlight(text, { language }).value
177+
// tab to 4 spaces
178+
highlighted = highlighted.replace(/\t/g, ' ')
177179
highlighted = highlighted
178180
.replace(/\r\n/g, `<br/>`)
179181
.replace(/\n/g, `<br/>`)

0 commit comments

Comments
 (0)