diff --git a/mode/markdown/markdown.js b/mode/markdown/markdown.js index 63ab0fc6f4f0d5c6197b7030e181552e16b06542..c81bb0d5ff69d2bfccb86bb8719a101af9185fbf 100644 --- a/mode/markdown/markdown.js +++ b/mode/markdown/markdown.js @@ -376,15 +376,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var ch = stream.next(); - if (ch === '\\') { - stream.next(); - if (modeCfg.highlightFormatting) { - var type = getType(state); - var formattingEscape = tokenTypes.formatting + "-escape"; - return type ? type + " " + formattingEscape : formattingEscape; - } - } - // Matches link titles present on next line if (state.linkTitle) { state.linkTitle = false; @@ -420,6 +411,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return getType(state); } + if (ch === '\\') { + stream.next(); + if (modeCfg.highlightFormatting) { + var type = getType(state); + var formattingEscape = tokenTypes.formatting + "-escape"; + return type ? type + " " + formattingEscape : formattingEscape; + } + } + if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) { stream.match(/\[[^\]]*\]/); state.inline = state.f = linkHref;