cmark

My personal build of CMark ✏️

Commit
8713ff912aaf13926d799d7cbd61e5cf014ddb7e
Parent
22083ee5776508fa06a2d373f8a578256a5c63e3
Author
John MacFarlane <fiddlosopher@gmail.com>
Date

js: Use children instead of inline_content for Paragraph.

Diffstat

2 files changed, 7 insertions, 7 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/blocks.js 8 4 4
Modified js/lib/html-renderer.js 6 3 3
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
@@ -59,7 +59,7 @@ var makeBlock = function(tag, start_line, start_column) {
              // string_content is formed by concatenating strings, in finalize:
              string_content: "",
              strings: [],
-             inline_content: []
+             children: []
            };
 };
 
@@ -629,11 +629,11 @@ var processInlines = function(block) {
 
     switch(block.t) {
     case 'Paragraph':
-        newblock.inline_content =
+        newblock.children =
             this.inlineParser.parse(block.string_content.trim(), this.refmap);
         break;
     case 'Header':
-        newblock.inline_content =
+        newblock.children =
             this.inlineParser.parse(block.string_content.trim(), this.refmap);
         newblock.level = block.level;
         break;
@@ -652,7 +652,7 @@ var processInlines = function(block) {
         break;
     }
 
-    if (block.children) {
+    if (block.children && !newblock.children) {
         var newchildren = [];
         for (var i = 0; i < block.children.length; i++) {
             newchildren.push(this.processInlines(block.children[i]));
diff --git a/js/lib/html-renderer.js b/js/lib/html-renderer.js
@@ -78,9 +78,9 @@ var renderBlock = function(block, in_tight_list) {
         return (whole_doc === '' ? '' : whole_doc + '\n');
     case 'Paragraph':
         if (in_tight_list) {
-            return this.renderInlines(block.inline_content);
+            return this.renderInlines(block.children);
         } else {
-            return inTags('p', [], this.renderInlines(block.inline_content));
+            return inTags('p', [], this.renderInlines(block.children));
         }
         break;
     case 'BlockQuote':
@@ -105,7 +105,7 @@ var renderBlock = function(block, in_tight_list) {
                       this.innersep);
     case 'Header':
         tag = 'h' + block.level;
-        return inTags(tag, [], this.renderInlines(block.inline_content));
+        return inTags(tag, [], this.renderInlines(block.children));
     case 'CodeBlock':
         info_words = block.info ? block.info.split(/ +/) : [];
         attr = (info_words.length === 0 || info_words[0].length === 0) ?