4 var listRE
= /^(\s*)([*+-]|(\d+)\.)(\s*)/,
5 unorderedBullets
= '*+-';
7 CodeMirror
.commands
.newlineAndIndentContinueMarkdownList = function(cm
) {
8 var pos
= cm
.getCursor(),
9 inList
= cm
.getStateAfter(pos
.line
).list
,
12 if (!inList
|| !(match
= cm
.getLine(pos
.line
).match(listRE
))) {
13 cm
.execCommand('newlineAndIndent');
17 var indent
= match
[1], after
= match
[4];
18 var bullet
= unorderedBullets
.indexOf(match
[2]) >= 0
20 : (parseInt(match
[3], 10) + 1) + '.';
22 cm
.replaceSelection('\n' + indent
+ bullet
+ after
, 'end');