cmark

My personal build of CMark ✏️

Commit
982ba5a528111dbf647e90f412498e315fcf432c
Parent
12e9e3c4d06fa33f2d72ea4eb7ee2978f59c1313
Author
John MacFarlane <jgm@berkeley.edu>
Date

Moved normalization step from XML renderer to main.

Diffstat

2 files changed, 6 insertions, 4 deletions

Status File Name N° Changes Insertions Deletions
Modified src/main.c 6 6 0
Modified src/xml.c 4 0 4
diff --git a/src/main.c b/src/main.c
@@ -152,6 +152,12 @@ int main(int argc, char *argv[])
 	end_timer("finishing document");
 	cmark_parser_free(parser);
 
+	if (options & CMARK_OPT_NORMALIZE) {
+		start_timer();
+		cmark_consolidate_text_nodes(document);
+		end_timer("normalizing document");
+	}
+
 	start_timer();
 	print_document(document, writer, options);
 	end_timer("print_document");
diff --git a/src/xml.c b/src/xml.c
@@ -153,10 +153,6 @@ char *cmark_render_xml(cmark_node *root, long options)
 	cmark_node *cur;
 	struct render_state state = { &xml, 0 };
 
-	if (options & CMARK_OPT_NORMALIZE) {
-		cmark_consolidate_text_nodes(root);
-	}
-
 	cmark_iter *iter = cmark_iter_new(root);
 
 	cmark_strbuf_puts(state.xml,