Skip to content

Commit 63f762b

Browse files
committed
[markdown mode] Don't allow backslash-escaping in code fragments
Closes codemirror#3800
1 parent f9b1e2d commit 63f762b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mode/markdown/markdown.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
376376

377377
var ch = stream.next();
378378

379-
if (ch === '\\') {
380-
stream.next();
381-
if (modeCfg.highlightFormatting) {
382-
var type = getType(state);
383-
var formattingEscape = tokenTypes.formatting + "-escape";
384-
return type ? type + " " + formattingEscape : formattingEscape;
385-
}
386-
}
387-
388379
// Matches link titles present on next line
389380
if (state.linkTitle) {
390381
state.linkTitle = false;
@@ -420,6 +411,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
420411
return getType(state);
421412
}
422413

414+
if (ch === '\\') {
415+
stream.next();
416+
if (modeCfg.highlightFormatting) {
417+
var type = getType(state);
418+
var formattingEscape = tokenTypes.formatting + "-escape";
419+
return type ? type + " " + formattingEscape : formattingEscape;
420+
}
421+
}
422+
423423
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
424424
stream.match(/\[[^\]]*\]/);
425425
state.inline = state.f = linkHref;

0 commit comments

Comments
 (0)