File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/components/codeHighlights Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,17 @@ export function makeHighlightBlocks(
4242
4343 if ( isHighlightedLine ) {
4444 highlightedLineElements . push ( element ) ;
45- }
4645
47- if ( ! isHighlightedLine || index === items . length - 1 ) {
46+ // If it's the last line that's highlighted, push it
47+ if ( index === items . length - 1 ) {
48+ arr . push (
49+ < HighlightBlock key = { highlightElementGroupCounter } language = { language } >
50+ { ...highlightedLineElements }
51+ </ HighlightBlock >
52+ ) ;
53+ }
54+ } else {
55+ // Check for an opened highlight group before pushing the new line
4856 if ( highlightedLineElements . length > 0 ) {
4957 arr . push (
5058 < HighlightBlock key = { highlightElementGroupCounter } language = { language } >
@@ -53,9 +61,9 @@ export function makeHighlightBlocks(
5361 ) ;
5462 highlightedLineElements = [ ] ;
5563 ++ highlightElementGroupCounter ;
56- } else {
57- arr . push ( child ) ;
5864 }
65+
66+ arr . push ( child ) ;
5967 }
6068
6169 return arr ;
You can’t perform that action at this time.
0 commit comments