Skip to content

Commit

Permalink
fix: render tab to spaces (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme authored Dec 24, 2024
1 parent 03b0e73 commit 23de645
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/>`)
Expand Down

0 comments on commit 23de645

Please sign in to comment.