Skip to content

Commit

Permalink
fix: fill all empty code lines
Browse files Browse the repository at this point in the history
closes #3305
  • Loading branch information
brc-dd committed Dec 31, 2023
1 parent 6c89943 commit 563020b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/node/markdown/plugins/highlight.ts
Expand Up @@ -147,11 +147,8 @@ export async function highlight(
return s
}

const fillEmptyHighlightedLine = (s: string) => {
return s.replace(
/(<span class="line highlighted">)(<\/span>)/g,
'$1<wbr>$2'
)
const fillEmptyLines = (s: string) => {
return s.replace(/(<span class="line[^>]*>)(<\/span>)/g, '$1<wbr>$2')
}

str = removeMustache(str).trimEnd()
Expand All @@ -175,6 +172,6 @@ export async function highlight(
: { theme })
})

return fillEmptyHighlightedLine(restoreMustache(highlighted))
return fillEmptyLines(restoreMustache(highlighted))
}
}

0 comments on commit 563020b

Please sign in to comment.