Commit 9708510 1 parent 6ce88da commit 9708510 Copy full SHA for 9708510
File tree 1 file changed +19
-14
lines changed
src/node/markdown/plugins
1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -136,23 +136,28 @@ export async function highlight(
136
136
return s
137
137
}
138
138
139
+ const fillEmptyHighlightedLine = ( s : string ) => {
140
+ return s . replace (
141
+ / ( < s p a n c l a s s = " l i n e h i g h l i g h t e d " > ) ( < \/ s p a n > ) / g,
142
+ '$1<wbr>$2'
143
+ )
144
+ }
145
+
139
146
str = removeMustache ( str )
140
147
141
148
const codeToHtml = ( theme : IThemeRegistration ) => {
142
- return cleanup (
143
- restoreMustache (
144
- lang === 'ansi'
145
- ? highlighter . ansiToHtml ( str , {
146
- lineOptions,
147
- theme : getThemeName ( theme )
148
- } )
149
- : highlighter . codeToHtml ( str , {
150
- lang,
151
- lineOptions,
152
- theme : getThemeName ( theme )
153
- } )
154
- )
155
- )
149
+ const res =
150
+ lang === 'ansi'
151
+ ? highlighter . ansiToHtml ( str , {
152
+ lineOptions,
153
+ theme : getThemeName ( theme )
154
+ } )
155
+ : highlighter . codeToHtml ( str , {
156
+ lang,
157
+ lineOptions,
158
+ theme : getThemeName ( theme )
159
+ } )
160
+ return fillEmptyHighlightedLine ( cleanup ( restoreMustache ( res ) ) )
156
161
}
157
162
158
163
if ( hasSingleTheme ) return codeToHtml ( theme )
You can’t perform that action at this time.
0 commit comments