I have taken a look with the debugger in the code, in the lang-markdown, and I found, that for state " code" (4 spaces and "code"), and cursor at the end, in this code:
const insertNewlineContinueMarkup = ({ state, dispatch }) => {
let tree = syntaxTree(state), { doc } = state;
let dont = null, changes = state.changeByRange(range => {
if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) {
return dont = { range };
}
let pos = range.from, line = doc.lineAt(pos);
let context = getContext(tree.resolveInner(pos, -1), line.text, doc);
while (context.length && context[context.length - 1].from > pos - line.from)
context.pop();
if (!context.length)
return dont = { range };
let inner = context[context.length - 1];
if (inner.to - inner.spaceAfter.length > pos - line.from) {
return dont = { range };
}
It comes into the second if,
if (!context.length)
return dont = { range };
and returns from the insertNewlineContinueMarkup() command. context.length is 0. Then the native Enter kicks in and adds a native new line, not the indented one.