cmark

My personal build of CMark ✏️

Commit
f988ab6d41855de43c157633852f0fe3c0770c6d
Parent
e1f188f651973e1902e92148d4ee93a80ee602e8
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fix sourcepos for blockquotes.

Fixes #142.

Diffstat

1 file changed, 3 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 4 3 1
diff --git a/src/blocks.c b/src/blocks.c
@@ -862,6 +862,8 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
 
     if (!indented && peek_at(input, parser->first_nonspace) == '>') {
 
+      bufsize_t blockquote_startpos = parser->first_nonspace;
+
       S_advance_offset(parser, input,
                        parser->first_nonspace + 1 - parser->offset, false);
       // optional following character
@@ -869,7 +871,7 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
         S_advance_offset(parser, input, 1, true);
       }
       *container = add_child(parser, *container, CMARK_NODE_BLOCK_QUOTE,
-                             parser->offset + 1);
+                             blockquote_startpos + 1);
 
     } else if (!indented && (matched = scan_atx_heading_start(
                                  input, parser->first_nonspace))) {