|
@ -92,6 +92,7 @@ module.exports = function list(state, startLine, endLine, silent) { |
|
|
subState, |
|
|
subState, |
|
|
posNext, |
|
|
posNext, |
|
|
contentStart, |
|
|
contentStart, |
|
|
|
|
|
listTokIdx, |
|
|
rules_named = state.lexerBlock.rules_named; |
|
|
rules_named = state.lexerBlock.rules_named; |
|
|
|
|
|
|
|
|
// Detect list type and position after marker
|
|
|
// Detect list type and position after marker
|
|
@ -107,17 +108,23 @@ module.exports = function list(state, startLine, endLine, silent) { |
|
|
if (silent) { return true; } |
|
|
if (silent) { return true; } |
|
|
|
|
|
|
|
|
// Start list
|
|
|
// Start list
|
|
|
|
|
|
listTokIdx = state.tokens.length; |
|
|
|
|
|
|
|
|
if (isOrdered) { |
|
|
if (isOrdered) { |
|
|
start = state.bMarks[startLine] + state.tShift[startLine]; |
|
|
start = state.bMarks[startLine] + state.tShift[startLine]; |
|
|
markerValue = Number(state.src.substr(start, posAfterMarker - start - 1)); |
|
|
markerValue = Number(state.src.substr(start, posAfterMarker - start - 1)); |
|
|
|
|
|
|
|
|
state.tokens.push({ |
|
|
state.tokens.push({ |
|
|
type: 'ordered_list_open', |
|
|
type: 'ordered_list_open', |
|
|
order: markerValue |
|
|
order: markerValue, |
|
|
|
|
|
tight: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
state.tokens.push({ type: 'bullet_list_open' }); |
|
|
state.tokens.push({ |
|
|
|
|
|
type: 'bullet_list_open', |
|
|
|
|
|
tight: true |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
@ -183,6 +190,7 @@ module.exports = function list(state, startLine, endLine, silent) { |
|
|
|
|
|
|
|
|
// Check that list is not terminated with another block type
|
|
|
// Check that list is not terminated with another block type
|
|
|
if (rules_named.fences(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.fences(state, nextLine, endLine, true)) { break; } |
|
|
|
|
|
if (rules_named.blockquote(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.hr(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.hr(state, nextLine, endLine, true)) { break; } |
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
@ -207,7 +215,6 @@ module.exports = function list(state, startLine, endLine, silent) { |
|
|
|
|
|
|
|
|
if (rules_named.heading(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.heading(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.lheading(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.lheading(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.blockquote(state, nextLine, endLine, true)) { break; } |
|
|
|
|
|
if (rules_named.table(state, nextLine, endLine, true)) { break; } |
|
|
if (rules_named.table(state, nextLine, endLine, true)) { break; } |
|
|
//if (rules_named.tag(state, nextLine, endLine, true)) { break; }
|
|
|
//if (rules_named.tag(state, nextLine, endLine, true)) { break; }
|
|
|
//if (rules_named.def(state, nextLine, endLine, true)) { break; }
|
|
|
//if (rules_named.def(state, nextLine, endLine, true)) { break; }
|
|
@ -226,6 +233,12 @@ module.exports = function list(state, startLine, endLine, silent) { |
|
|
state.eMarks[lastNonEmptyLine]) |
|
|
state.eMarks[lastNonEmptyLine]) |
|
|
.replace(RegExp('^ {1,' + indent + '}', 'mg'), '')); |
|
|
.replace(RegExp('^ {1,' + indent + '}', 'mg'), '')); |
|
|
state.lexerBlock.tokenize(subState, 0, subState.lineMax); |
|
|
state.lexerBlock.tokenize(subState, 0, subState.lineMax); |
|
|
|
|
|
|
|
|
|
|
|
// If any of list item is loose, mark list as loose
|
|
|
|
|
|
if (!subState.tight) { |
|
|
|
|
|
state.tokens[listTokIdx] = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
state.tokens.push({ type: 'list_item_close' }); |
|
|
state.tokens.push({ type: 'list_item_close' }); |
|
|
|
|
|
|
|
|
if (!hasNextItem) { break; } |
|
|
if (!hasNextItem) { break; } |
|
|