@@ -86,12 +86,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
86
86
87
87
var hrRE = / ^ ( [ * \- _ ] ) (?: \s * \1) { 2 , } \s * $ /
88
88
, listRE = / ^ (?: [ * \- + ] | ^ [ 0 - 9 ] + ( [ . ) ] ) ) \s + /
89
- , taskListRE = / ^ \[ ( x | ) \] (? = \s ) / // Must follow listRE
89
+ , taskListRE = / ^ \[ ( x | ) \] (? = \s ) / i // Must follow listRE
90
90
, atxHeaderRE = modeCfg . allowAtxHeaderWithoutSpace ? / ^ ( # + ) / : / ^ ( # + ) (?: | $ ) /
91
91
, setextHeaderRE = / ^ * (?: \= { 1 , } | - { 1 , } ) \s * $ /
92
92
, textRE = / ^ [ ^ # ! \[ \] * _ \\ < > \$ ` " ' ( ~ : ] + /
93
93
, fencedCodeRE = / ^ ( ~ ~ ~ + | ` ` ` + ) [ \t ] * ( [ \w + # - ] * ) [ ^ \n ` ] * $ /
94
- , linkDefRE = / ^ \s * \[ [ ^ \] ] + ?\] : \s * \S + ( \s * \S * \s * ) ? $ / // naive link-definition
94
+ , linkDefRE = / ^ \s * \[ [ ^ \] ] + ?\] : . * $ / // naive link-definition
95
95
, punctuation = / [ ! \" # $ % & \' ( ) * + , \- \. \/ : ; < = > ? @ \[ \\ \] ^ _ ` { | } ~ — ] /
96
96
, expandedTab = " " // CommonMark specifies tab as 4 spaces
97
97
, fencedMathRE = / ^ ( \$ \$ ) [ \t ] * ( [ \w + # - ] * ) [ ^ \n ` ] * $ /
@@ -115,6 +115,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
115
115
function blankLine ( state ) {
116
116
// Reset linkTitle state
117
117
state . linkTitle = false ;
118
+ state . linkHref = false ;
119
+ state . linkText = false ;
118
120
// Reset EM state
119
121
state . em = false ;
120
122
// Reset STRONG state
@@ -153,6 +155,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
153
155
if ( state . indentationDiff === null ) {
154
156
state . indentationDiff = state . indentation ;
155
157
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
+
156
164
state . list = null ;
157
165
// While this list item's marker's indentation is less than the deepest
158
166
// list item's content's indentation,pop the deepest list item
@@ -424,7 +432,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
424
432
}
425
433
426
434
if ( state . taskList ) {
427
- var taskOpen = stream . match ( taskListRE , true ) [ 1 ] !== "x ";
435
+ var taskOpen = stream . match ( taskListRE , true ) [ 1 ] === " ";
428
436
if ( taskOpen ) state . taskOpen = true ;
429
437
else state . taskClosed = true ;
430
438
if ( modeCfg . highlightFormatting ) state . formatting = "task" ;
@@ -820,6 +828,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
820
828
formatting : false ,
821
829
linkText : s . linkText ,
822
830
linkTitle : s . linkTitle ,
831
+ linkHref : s . linkHref ,
823
832
code : s . code ,
824
833
math : s . math ,
825
834
em : s . em ,
@@ -865,12 +874,14 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
865
874
state . trailingSpace = 0 ;
866
875
state . trailingSpaceNewLine = false ;
867
876
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
+ }
874
885
}
875
886
}
876
887
return state . f ( stream , state ) ;
@@ -898,6 +909,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
898
909
return mode ;
899
910
} , "xml" ) ;
900
911
912
+ CodeMirror . defineMIME ( "text/markdown" , "markdown" ) ;
913
+
901
914
CodeMirror . defineMIME ( "text/x-markdown" , "markdown" ) ;
902
915
903
916
} ) ;
0 commit comments