File tree Expand file tree Collapse file tree
packages/color-diff-napi/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -528,19 +528,20 @@ function highlightLine(
528528 // hljs throws on unknown language despite ignoreIllegals
529529 return [ [ defaultStyle ( theme ) , code ] ]
530530 }
531- if ( ! hasRootNode ( result . emitter ) ) {
531+ const emitter = result . _emitter || { } ;
532+ if ( ! hasRootNode ( emitter ) ) {
532533 if ( ! loggedEmitterShapeError ) {
533534 loggedEmitterShapeError = true
534535 logError (
535536 new Error (
536- `color-diff: hljs emitter shape mismatch (keys: ${ Object . keys ( result . emitter ) . join ( ',' ) } ). Syntax highlighting disabled.` ,
537+ `color-diff: hljs emitter shape mismatch (keys: ${ Object . keys ( emitter ) . join ( ',' ) } ). Syntax highlighting disabled.` ,
537538 ) ,
538539 )
539540 }
540541 return [ [ defaultStyle ( theme ) , code ] ]
541542 }
542543 const blocks : Block [ ] = [ ]
543- flattenHljs ( result . emitter . rootNode , theme , undefined , blocks )
544+ flattenHljs ( emitter . rootNode , theme , undefined , blocks )
544545 return blocks
545546}
546547
You can’t perform that action at this time.
0 commit comments