|
|
|
@ -136,11 +136,17 @@ export async function highlight(
|
|
|
|
|
return s
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fillEmptyHighlightedLine = (s: string) => {
|
|
|
|
|
return s.replace(
|
|
|
|
|
/(<span class="line highlighted">)(<\/span>)/g,
|
|
|
|
|
'$1<wbr>$2'
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str = removeMustache(str)
|
|
|
|
|
|
|
|
|
|
const codeToHtml = (theme: IThemeRegistration) => {
|
|
|
|
|
return cleanup(
|
|
|
|
|
restoreMustache(
|
|
|
|
|
const res =
|
|
|
|
|
lang === 'ansi'
|
|
|
|
|
? highlighter.ansiToHtml(str, {
|
|
|
|
|
lineOptions,
|
|
|
|
@ -151,8 +157,7 @@ export async function highlight(
|
|
|
|
|
lineOptions,
|
|
|
|
|
theme: getThemeName(theme)
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
return fillEmptyHighlightedLine(cleanup(restoreMustache(res)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasSingleTheme) return codeToHtml(theme)
|
|
|
|
|