validate code line numbers to highlight
This commit is contained in:
parent
8690858b6f
commit
da53b3a637
@ -115,10 +115,13 @@ var RevealHighlight = (function() {
|
||||
|
||||
linesToHighlight = linesToHighlight || block.getAttribute( 'data-line-numbers' );
|
||||
|
||||
if( typeof linesToHighlight === 'string' ) {
|
||||
if( typeof linesToHighlight === 'string' && linesToHighlight !== '' ) {
|
||||
|
||||
linesToHighlight.split( ',' ).forEach( function( lineNumbers ) {
|
||||
|
||||
// Ensure that we looking at a valid slide number (1 or 1-2)
|
||||
if( /^[\d-]+$/.test( lineNumbers ) ) {
|
||||
|
||||
lineNumbers = lineNumbers.split( '-' )
|
||||
|
||||
var lineStart = lineNumbers[0];
|
||||
@ -128,6 +131,8 @@ var RevealHighlight = (function() {
|
||||
lineElement.classList.add( 'highlight-line' );
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user