cmark

My personal build of CMark ✏️

Commit
73f6a4c1dafeb59b3a9615e071afae2b516a03fc
Parent
3c0b582b52021a6abea644f056a4da4301e2bc30
Author
John MacFarlane <fiddlosopher@gmail.com>
Date

Move normalization step from main to cmark_parser_finish.

Diffstat

2 files changed, 6 insertions, 6 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 6 6 0
Modified src/main.c 6 0 6
diff --git a/src/blocks.c b/src/blocks.c
@@ -869,7 +869,13 @@ cmark_node *cmark_parser_finish(cmark_parser *parser)
 	}
 
 	finalize_document(parser);
+
+	if (parser->options & CMARK_OPT_NORMALIZE) {
+		cmark_consolidate_text_nodes(parser->root);
+	}
+
 	cmark_strbuf_free(parser->curline);
+
 #if CMARK_DEBUG_NODES
 	if (cmark_node_check(parser->root, stderr)) {
 		abort();
diff --git a/src/main.c b/src/main.c
@@ -152,12 +152,6 @@ 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");