cmark

My personal build of CMark ✏️

Commit
a3be6dc81c971fa1b3c656d82f7e96794d510212
Parent
e8809f7e448bffc51adac1f2e143d99496d6a55f
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fixed #192.

The C and JS implementations were not registering blank lines after atx headers for purposes of tight/loose list calculation.

Exmaple:

* item * # block1

## block2

Diffstat

2 files changed, 8 insertions, 0 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/blocks.js 4 4 0
Modified src/blocks.c 4 4 0
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
@@ -266,6 +266,9 @@ var incorporateLine = function(ln, line_number) {
         case 'HorizontalRule':
             // a header can never container > 1 line, so fail to match:
             all_matched = false;
+            if (blank) {
+                container.last_line_blank = true;
+            }
             break;
 
         case 'FencedCode':
@@ -279,6 +282,7 @@ var incorporateLine = function(ln, line_number) {
 
         case 'HtmlBlock':
             if (blank) {
+                container.last_line_blank = true;
                 all_matched = false;
             }
             break;
diff --git a/src/blocks.c b/src/blocks.c
@@ -553,6 +553,9 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
 
 			// a header can never contain more than one line
 			all_matched = false;
+			if (blank) {
+				container->last_line_blank = true;
+			}
 
 		} else if (container->type == NODE_FENCED_CODE) {
 
@@ -566,6 +569,7 @@ void cmark_process_line(cmark_doc_parser *parser, const char *buffer,
 		} else if (container->type == NODE_HTML) {
 
 			if (blank) {
+				container->last_line_blank = true;
 				all_matched = false;
 			}