Changed markdown lexer to ignore lists containing only one item

Этот коммит содержится в:
hmhealey
2015-11-05 16:49:43 -05:00
родитель f0578868ed
Коммит 431cb089ed

Просмотреть файл

@@ -289,19 +289,22 @@ class MattermostLexer extends marked.Lexer {
// list // list
cap = this.rules.list.exec(src); cap = this.rules.list.exec(src);
if (cap) { if (cap) {
src = src.substring(cap[0].length);
const bull = cap[2]; const bull = cap[2];
let l = cap[0].length;
// Get each top-level item.
cap = cap[0].match(this.rules.item);
if (cap.length > 1) {
src = src.substring(l);
this.tokens.push({ this.tokens.push({
type: 'list_start', type: 'list_start',
ordered: bull.length > 1 ordered: bull.length > 1
}); });
// Get each top-level item.
cap = cap[0].match(this.rules.item);
let next = false; let next = false;
const l = cap.length; l = cap.length;
for (let i = 0; i < l; i++) { for (let i = 0; i < l; i++) {
let item = cap[i]; let item = cap[i];
@@ -358,6 +361,7 @@ class MattermostLexer extends marked.Lexer {
continue; continue;
} }
}
// html // html
cap = this.rules.html.exec(src); cap = this.rules.html.exec(src);