@@ -86,12 +86,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
8686
8787 var hrRE = / ^ ( [ * \- _ ] ) (?: \s * \1) { 2 , } \s * $ /
8888 , listRE = / ^ (?: [ * \- + ] | ^ [ 0 - 9 ] + ( [ . ) ] ) ) \s + /
89- , taskListRE = / ^ \[ ( x | ) \] (? = \s ) / // Must follow listRE
89+ , taskListRE = / ^ \[ ( x | ) \] (? = \s ) / i // Must follow listRE
9090 , atxHeaderRE = modeCfg . allowAtxHeaderWithoutSpace ? / ^ ( # + ) / : / ^ ( # + ) (?: | $ ) /
9191 , setextHeaderRE = / ^ * (?: \= { 1 , } | - { 1 , } ) \s * $ /
9292 , textRE = / ^ [ ^ # ! \[ \] * _ \\ < > \$ ` " ' ( ~ : ] + /
9393 , fencedCodeRE = / ^ ( ~ ~ ~ + | ` ` ` + ) [ \t ] * ( [ \w + # - ] * ) [ ^ \n ` ] * $ /
94- , linkDefRE = / ^ \s * \[ [ ^ \] ] + ?\] : \s * \S + ( \s * \S * \s * ) ? $ / // naive link-definition
94+ , linkDefRE = / ^ \s * \[ [ ^ \] ] + ?\] : . * $ / // naive link-definition
9595 , punctuation = / [ ! \" # $ % & \' ( ) * + , \- \. \/ : ; < = > ? @ \[ \\ \] ^ _ ` { | } ~ — ] /
9696 , expandedTab = " " // CommonMark specifies tab as 4 spaces
9797 , fencedMathRE = / ^ ( \$ \$ ) [ \t ] * ( [ \w + # - ] * ) [ ^ \n ` ] * $ /
@@ -115,6 +115,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
115115 function blankLine ( state ) {
116116 // Reset linkTitle state
117117 state . linkTitle = false ;
118+ state . linkHref = false ;
119+ state . linkText = false ;
118120 // Reset EM state
119121 state . em = false ;
120122 // Reset STRONG state
@@ -153,6 +155,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
153155 if ( state . indentationDiff === null ) {
154156 state . indentationDiff = state . indentation ;
155157 if ( prevLineIsList ) {
158+ // Reset inline styles which shouldn't propagate aross list items
159+ state . em = false ;
160+ state . strong = false ;
161+ state . code = false ;
162+ state . strikethrough = false ;
163+
156164 state . list = null ;
157165 // While this list item's marker's indentation is less than the deepest
158166 // list item's content's indentation,pop the deepest list item
@@ -424,7 +432,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
424432 }
425433
426434 if ( state . taskList ) {
427- var taskOpen = stream . match ( taskListRE , true ) [ 1 ] !== "x ";
435+ var taskOpen = stream . match ( taskListRE , true ) [ 1 ] === " ";
428436 if ( taskOpen ) state . taskOpen = true ;
429437 else state . taskClosed = true ;
430438 if ( modeCfg . highlightFormatting ) state . formatting = "task" ;
@@ -820,6 +828,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
820828 formatting : false ,
821829 linkText : s . linkText ,
822830 linkTitle : s . linkTitle ,
831+ linkHref : s . linkHref ,
823832 code : s . code ,
824833 math : s . math ,
825834 em : s . em ,
@@ -865,12 +874,14 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
865874 state . trailingSpace = 0 ;
866875 state . trailingSpaceNewLine = false ;
867876
868- state . f = state . block ;
869- if ( state . f != htmlBlock ) {
870- var indentation = stream . match ( / ^ \s * / , true ) [ 0 ] . replace ( / \t / g, expandedTab ) . length ;
871- state . indentation = indentation ;
872- state . indentationDiff = null ;
873- if ( indentation > 0 ) return null ;
877+ if ( ! state . localState ) {
878+ state . f = state . block ;
879+ if ( state . f != htmlBlock ) {
880+ var indentation = stream . match ( / ^ \s * / , true ) [ 0 ] . replace ( / \t / g, expandedTab ) . length ;
881+ state . indentation = indentation ;
882+ state . indentationDiff = null ;
883+ if ( indentation > 0 ) return null ;
884+ }
874885 }
875886 }
876887 return state . f ( stream , state ) ;
@@ -898,6 +909,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
898909 return mode ;
899910} , "xml" ) ;
900911
912+ CodeMirror . defineMIME ( "text/markdown" , "markdown" ) ;
913+
901914CodeMirror . defineMIME ( "text/x-markdown" , "markdown" ) ;
902915
903916} ) ;
0 commit comments