@@ -121,29 +121,29 @@ CodeMirror.defineMode(
121121 state . linkTitle = false ;
122122 state . linkHref = false ;
123123 state . linkText = false ;
124-
124+
125125 // Reset EM state
126126 state . em = false ;
127-
127+
128128 // Reset STRONG state
129129 state . strong = false ;
130-
130+
131131 // Reset strikethrough state
132132 state . strikethrough = false ;
133-
133+
134134 // Reset state.quote
135135 state . quote = 0 ;
136-
136+
137137 // Reset state.indentedCode
138138 state . indentedCode = false ;
139139
140140 // console.log(state.f.name, state.f.name === 'local');
141- if ( state . f && state . f . name === ' local' ) {
141+ if ( state . f == local ) {
142142 // console.log("state", state, state.thisLine);
143143 // state.thisLine.formatting = 'line-local';
144144 returnState = 'line-cm-blockcode' ;
145145 }
146-
146+
147147 if ( state . f == htmlBlock ) {
148148 var exit = htmlModeMissing ;
149149 if ( ! exit ) {
@@ -161,7 +161,7 @@ CodeMirror.defineMode(
161161 // Reset state.trailingSpace
162162 state . trailingSpace = 0 ;
163163 state . trailingSpaceNewLine = false ;
164-
164+
165165 // Mark this line as blank
166166 state . prevLine = state . thisLine ;
167167 // state.thisLine = {
@@ -287,18 +287,18 @@ CodeMirror.defineMode(
287287 state . formatting = [ 'list' , `list-${ listType } ` ] ;
288288 return getType ( state ) ;
289289 } else if ( firstTokenOnLine && state . indentation <= maxNonCodeIndentation && ( match = stream . match ( fencedCodeRE , true ) ) ) {
290-
290+
291291 state . quote = 0 ;
292292 state . fencedEndRE = new RegExp ( match [ 1 ] + '+ *$' ) ;
293293 // try switching mode
294294 state . localMode = modeCfg . fencedCodeBlockHighlighting && getMode ( match [ 2 ] ) ;
295-
295+
296296 if ( state . localMode ) {
297297 state . localState = CodeMirror . startState ( state . localMode ) ;
298298 }
299-
299+
300300 state . f = state . block = local ;
301-
301+
302302 if ( modeCfg . highlightFormatting ) {
303303 state . formatting = 'blockcode' ;
304304 }
@@ -364,34 +364,34 @@ CodeMirror.defineMode(
364364 }
365365
366366 function local ( stream , state ) {
367-
367+
368368 var currListInd = state . listStack [ state . listStack . length - 1 ] || 0 ;
369369 var hasExitedList = state . indentation < currListInd ;
370370 var maxFencedEndInd = currListInd + 3 ;
371-
371+
372372 if ( state . fencedEndRE && state . indentation <= maxFencedEndInd && ( hasExitedList || stream . match ( state . fencedEndRE ) ) ) {
373-
373+
374374 if ( modeCfg . highlightFormatting ) {
375375 state . formatting = 'blockcode' ;
376376 }
377377
378378 var returnType ;
379-
379+
380380 if ( ! hasExitedList ) {
381381 returnType = getType ( state ) ;
382382 }
383-
383+
384384 state . localMode = state . localState = null ;
385385 state . block = blockNormal ;
386386 state . f = inlineNormal ;
387387 state . fencedEndRE = null ;
388388 state . code = 0 ;
389389 state . thisLine . fencedCodeEnd = true ;
390-
390+
391391 if ( hasExitedList ) {
392392 return switchBlock ( stream , state , state . block ) ;
393393 }
394-
394+
395395 return returnType ;
396396 } else if ( state . localMode ) {
397397 // By prepending `line-cm-code` every line of the local
@@ -414,7 +414,7 @@ CodeMirror.defineMode(
414414 state . formatting = [ state . formatting ] ;
415415
416416 for ( var i = 0 ; i < state . formatting . length ; i ++ ) {
417-
417+
418418 if ( ! / ^ ( l i s t - | b l o c k c o d e ) / . test ( state . formatting [ i ] ) ) {
419419 styles . push ( tokenTypes . formatting + '-' + state . formatting [ i ] ) ;
420420 } else {
@@ -745,17 +745,17 @@ CodeMirror.defineMode(
745745 if ( modeCfg . highlightFormatting ) {
746746 state . formatting = setEm == null ? 'strong' : setStrong == null ? 'em' : 'strong em' ;
747747 }
748-
748+
749749 if ( setEm === true ) {
750750 state . em = ch ;
751751 }
752-
752+
753753 if ( setStrong === true ) {
754754 state . strong = ch ;
755755 }
756-
756+
757757 var t = getType ( state ) ;
758-
758+
759759 if ( setEm === false ) {
760760 state . em = false ;
761761 }
@@ -789,7 +789,7 @@ CodeMirror.defineMode(
789789 }
790790 var t = getType ( state ) ;
791791 state . strikethrough = false ;
792-
792+
793793 return t ;
794794
795795 } else if ( stream . match ( / ^ [ ^ \s ] / , false ) ) {
@@ -817,11 +817,11 @@ CodeMirror.defineMode(
817817
818818 if ( modeCfg . emoji && ch === ':' && stream . match ( / ^ [ a - z _ \d + - ] + : / ) ) {
819819 state . emoji = true ;
820-
820+
821821 if ( modeCfg . highlightFormatting ) {
822822 state . formatting = 'emoji' ;
823823 }
824-
824+
825825 var retType = getType ( state ) ;
826826 state . emoji = false ;
827827 return retType ;
@@ -1034,10 +1034,9 @@ CodeMirror.defineMode(
10341034 state . header = 0 ;
10351035 state . hr = false ;
10361036
1037- // if (stream.match(/^\s*$/, true)) {
1038- // blankLine(state);
1039- // return null;
1040- // }
1037+ if ( stream . match ( / ^ \s * $ / , true ) ) {
1038+ return blankLine ( state ) ;
1039+ }
10411040
10421041 state . prevLine = state . thisLine ;
10431042 state . thisLine = {
0 commit comments