cmark

My personal build of CMark ✏️

Commit
f499e4f2be96ec56844afcc59c3db26038066d27
Parent
625c93769b81938781ba19450b15debd4ef7e396
Author
John MacFarlane <jgm@berkeley.edu>
Date

Propagate lastLineBlank up through parents.

Previously we just kept it set on the bottom child. But this will give a quicker determination of lastLineBlank.

Diffstat

1 file changed, 4 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/blocks.js 7 4 3
diff --git 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;
         }