Sha256: da6abbf7fbaa58fb010658ae17aff4f8f5dbfcd9c9d65513db182b68371e3454
Contents?: true
Size: 925 Bytes
Versions: 12
Compression:
Stored size: 925 Bytes
Contents
(function() { CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { var pos = cm.getCursor(), token = cm.getTokenAt(pos); var space; if (token.className == "string") { var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end}); var listStart = /\*|\d+\./, listContinue; if (token.string.search(listStart) == 0) { var reg = /^[\W]*(\d+)\./g; var matches = reg.exec(full); if(matches) listContinue = (parseInt(matches[1]) + 1) + ". "; else listContinue = "* "; space = full.slice(0, token.start); if (!/^\s*$/.test(space)) { space = ""; for (var i = 0; i < token.start; ++i) space += " "; } } } if (space != null) cm.replaceSelection("\n" + space + listContinue, "end"); else cm.execCommand("newlineAndIndent"); }; })();
Version data entries
12 entries across 11 versions & 3 rubygems