Browse Source

Fix nested code blocks inside lists

This is now parsed correctly:
---
 -      test
---
pull/14/head
Alex Kocharin 10 years ago
parent
commit
d8fd23eb49
  1. 8
      lib/lexer_block/list.js

8
lib/lexer_block/list.js

@ -78,6 +78,7 @@ function skipOrderedListMarker(state, startLine) {
module.exports = function list(state, startLine, endLine, silent) {
var nextLine,
indent,
oldTShift,
oldIndent,
oldTight,
start,
@ -163,7 +164,9 @@ module.exports = function list(state, startLine, endLine, silent) {
oldIndent = state.blkIndent;
oldTight = state.tight;
state.blkIndent = state.tShift[startLine] = indent;
oldTShift = state.tShift[startLine];
state.tShift[startLine] = contentStart - state.bMarks[startLine];
state.blkIndent = indent;
state.tight = true;
state.lexerBlock.tokenize(state, startLine, endLine, true);
@ -176,7 +179,8 @@ module.exports = function list(state, startLine, endLine, silent) {
// but we should filter last element, because it means list finish
prevEmptyEnd = (state.line - startLine) > 1 && isEmpty(state, state.line - 1);
state.blkIndent = state.tShift[startLine] = oldIndent;
state.blkIndent = oldIndent;
state.tShift[startLine] = oldTShift;
state.tight = oldTight;
state.tokens.push({ type: 'list_item_close' });

Loading…
Cancel
Save