From f499e4f2be96ec56844afcc59c3db26038066d27 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 21 Jan 2015 09:40:12 -0800 Subject: Propagate lastLineBlank up through parents. Previously we just kept it set on the bottom child. But this will give a quicker determination of lastLineBlank. --- js/lib/blocks.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/lib/blocks.js b/js/lib/blocks.js index abaea17..23b0283 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -506,16 +506,17 @@ var incorporateLine = function(ln) { // and we don't count blanks in fenced code for purposes of tight/loose // lists or breaking out of lists. We also don't set _lastLineBlank // on an empty list item, or if we just closed a fenced block. - container._lastLineBlank = blank && + var lastLineBlank = blank && !(t === 'BlockQuote' || (t === 'CodeBlock' && container._isFenced) || (t === 'Item' && !container._firstChild && container.sourcepos[0][0] === this.lineNumber)); + // propagate lastLineBlank up through parents: var cont = container; - while (cont._parent) { - cont._parent._lastLineBlank = false; + while (cont) { + cont._lastLineBlank = lastLineBlank; cont = cont._parent; } -- cgit v1.2.3