File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1004,13 +1004,14 @@ static void source_pos(test_batch_runner *runner) {
1004
1004
"> Sure.\n"
1005
1005
">\n"
1006
1006
"> 2. Yes, okay.\n"
1007
- "> \n" ;
1007
+ "> \n"
1008
+ "<!-- HTML Comment -->" ;
1008
1009
1009
1010
cmark_node * doc = cmark_parse_document (markdown , sizeof (markdown ) - 1 , CMARK_OPT_DEFAULT );
1010
1011
char * xml = cmark_render_xml (doc , CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS );
1011
1012
STR_EQ (runner , xml , "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1012
1013
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
1013
- "<document sourcepos=\"1:1-10:20 \" xmlns=\"http://commonmark.org/xml/1.0\">\n"
1014
+ "<document sourcepos=\"1:1-11:21 \" xmlns=\"http://commonmark.org/xml/1.0\">\n"
1014
1015
" <heading sourcepos=\"1:1-1:13\" level=\"1\">\n"
1015
1016
" <text sourcepos=\"1:3-1:5\" xml:space=\"preserve\">Hi </text>\n"
1016
1017
" <emph sourcepos=\"1:6-1:12\">\n"
@@ -1052,6 +1053,8 @@ static void source_pos(test_batch_runner *runner) {
1052
1053
" </item>\n"
1053
1054
" </list>\n"
1054
1055
" </block_quote>\n"
1056
+ " <html_block sourcepos=\"11:1-11:21\" xml:space=\"preserve\"><!-- HTML Comment -->\n"
1057
+ "</html_block>\n"
1055
1058
"</document>\n" ,
1056
1059
"sourcepos are as expected" );
1057
1060
free (xml );
Original file line number Diff line number Diff line change @@ -289,7 +289,8 @@ static cmark_node *finalize(cmark_parser *parser, cmark_node *b) {
289
289
b -> end_column = parser -> last_line_length ;
290
290
} else if (S_type (b ) == CMARK_NODE_DOCUMENT ||
291
291
(S_type (b ) == CMARK_NODE_CODE_BLOCK && b -> as .code .fenced ) ||
292
- (S_type (b ) == CMARK_NODE_HEADING && b -> as .heading .setext )) {
292
+ (S_type (b ) == CMARK_NODE_HEADING && b -> as .heading .setext ) ||
293
+ (parser -> line_number - 1 < b -> end_line )) {
293
294
b -> end_line = parser -> line_number ;
294
295
b -> end_column = parser -> curline .size ;
295
296
if (b -> end_column && parser -> curline .ptr [b -> end_column - 1 ] == '\n' )
You can’t perform that action at this time.
0 commit comments