Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit cb5416f

Browse files
committed
[markdown mode] Fix handling of escaped characters
Issue #2792
1 parent 376f3ec commit cb5416f

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

mode/markdown/markdown.js

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

361361
var ch = stream.next();
362362

363-
if (state.escape) {
364-
state.escape = false;
365-
return getType(state);
366-
}
367-
368363
if (ch === '\\') {
369-
if (modeCfg.highlightFormatting) state.formatting = "escape";
370-
state.escape = true;
371-
return getType(state);
364+
stream.next();
365+
if (modeCfg.highlightFormatting) return getType(state) + " escape";
372366
}
373367

374368
// Matches link titles present on next line
@@ -650,7 +644,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
650644
inline: inlineNormal,
651645
text: handleText,
652646

653-
escape: false,
654647
formatting: false,
655648
linkText: false,
656649
linkHref: false,
@@ -683,7 +676,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
683676

684677
inline: s.inline,
685678
text: s.text,
686-
escape: false,
687679
formatting: false,
688680
linkTitle: s.linkTitle,
689681
em: s.em,
@@ -718,9 +710,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
718710
state.thisLineHasContent = true;
719711
}
720712

721-
// Reset state.escape
722-
state.escape = false;
723-
724713
// Reset state.taskList
725714
state.taskList = false;
726715

0 commit comments

Comments
 (0)