Skip to content

Commit 7580a1d

Browse files
committed
[markdown mode] Simplify leaving fenced block
Closes codemirror#4628
1 parent c88b02c commit 7580a1d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

mode/markdown/markdown.js

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,13 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
241241
function local(stream, state) {
242242
if (state.fencedChars && stream.match(state.fencedChars)) {
243243
if (modeCfg.highlightFormatting) state.formatting = "code-block";
244+
var returnType = getType(state)
244245
state.localMode = state.localState = null;
245-
state.f = state.block = leavingLocal;
246-
return getType(state)
246+
state.block = blockNormal;
247+
state.f = inlineNormal;
248+
state.fencedChars = null;
249+
state.code = 0
250+
return returnType;
247251
} else if (state.fencedChars && stream.skipTo(state.fencedChars)) {
248252
return "comment"
249253
} else if (state.localMode) {
@@ -254,18 +258,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
254258
}
255259
}
256260

257-
function leavingLocal(stream, state) {
258-
stream.match(state.fencedChars);
259-
state.block = blockNormal;
260-
state.f = inlineNormal;
261-
state.fencedChars = null;
262-
if (modeCfg.highlightFormatting) state.formatting = "code-block";
263-
state.code = 1
264-
var returnType = getType(state);
265-
state.code = 0
266-
return returnType;
267-
}
268-
269261
// Inline
270262
function getType(state) {
271263
var styles = [];

0 commit comments

Comments
 (0)