avoid exception when highlighting empty code blocks
This commit is contained in:
parent
9ac654d584
commit
a2e9e525d5
|
@ -117,6 +117,9 @@ c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});
|
||||||
|
|
||||||
hljs.highlightBlock( block );
|
hljs.highlightBlock( block );
|
||||||
|
|
||||||
|
// Don't generate line numbers for empty code blocks
|
||||||
|
if( block.innerHTML.trim().length === 0 ) return;
|
||||||
|
|
||||||
if( block.hasAttribute( 'data-line-numbers' ) ) {
|
if( block.hasAttribute( 'data-line-numbers' ) ) {
|
||||||
hljs.lineNumbersBlock( block, { singleLine: true } );
|
hljs.lineNumbersBlock( block, { singleLine: true } );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user