cmark

My personal build of CMark ✏️

Commit
005d6d07cba0cb7fe17fd2148791bbfd382defcf
Parent
41b3307db15bb02122223b8a16afeec54a9a69d7
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fix mistaken sourcepos for atx headers.

Closes #141.

Diffstat

1 file changed, 2 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 3 2 1
diff --git a/src/blocks.c b/src/blocks.c
@@ -851,12 +851,13 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
                                  input, parser->first_nonspace))) {
       bufsize_t hashpos;
       int level = 0;
+      bufsize_t heading_startpos = parser->first_nonspace;
 
       S_advance_offset(parser, input,
                        parser->first_nonspace + matched - parser->offset,
                        false);
       *container =
-          add_child(parser, *container, CMARK_NODE_HEADING, parser->offset + 1);
+          add_child(parser, *container, CMARK_NODE_HEADING, heading_startpos + 1);
 
       hashpos = cmark_chunk_strchr(input, '#', parser->first_nonspace);