fix autoindent of numbered markdown lists
This commit is contained in:
parent
eba12ee3a5
commit
65b8b8a7e8
1 changed files with 6 additions and 5 deletions
|
|
@ -55,12 +55,13 @@ oop.inherits(Mode, TextMode);
|
||||||
(function() {
|
(function() {
|
||||||
this.getNextLineIndent = function(state, line, tab) {
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
if (state == "listblock") {
|
if (state == "listblock") {
|
||||||
var match = /^((?:.+)?)(([-+*]|\d+\.)\s+)/.exec(line);
|
var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
|
||||||
if (match) {
|
if (!match)
|
||||||
return new Array(match[1].length + 1).join(" ") + match[2];
|
|
||||||
} else {
|
|
||||||
return "";
|
return "";
|
||||||
}
|
var marker = match[2];
|
||||||
|
if (!marker)
|
||||||
|
marker = parseInt(match[3], 10) + 1 + ".";
|
||||||
|
return match[1] + marker + match[4];
|
||||||
} else {
|
} else {
|
||||||
return this.$getIndent(line);
|
return this.$getIndent(line);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue