@@ -527,7 +527,9 @@ static void render_xml(test_batch_runner *runner) {
527
527
528
528
static const char markdown [] = "foo *bar*\n"
529
529
"\n"
530
- "paragraph 2\n" ;
530
+ "paragraph 2\n"
531
+ "\n"
532
+ "```\ncode\n```\n" ;
531
533
cmark_node * doc =
532
534
cmark_parse_document (markdown , sizeof (markdown ) - 1 , CMARK_OPT_DEFAULT );
533
535
@@ -536,14 +538,16 @@ static void render_xml(test_batch_runner *runner) {
536
538
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
537
539
"<document xmlns=\"http://commonmark.org/xml/1.0\">\n"
538
540
" <paragraph>\n"
539
- " <text>foo </text>\n"
541
+ " <text xml:space=\"preserve\" >foo </text>\n"
540
542
" <emph>\n"
541
- " <text>bar</text>\n"
543
+ " <text xml:space=\"preserve\" >bar</text>\n"
542
544
" </emph>\n"
543
545
" </paragraph>\n"
544
546
" <paragraph>\n"
545
- " <text>paragraph 2</text>\n"
547
+ " <text xml:space=\"preserve\" >paragraph 2</text>\n"
546
548
" </paragraph>\n"
549
+ " <code_block xml:space=\"preserve\">code\n"
550
+ "</code_block>\n"
547
551
"</document>\n" ,
548
552
"render document" );
549
553
free (xml );
@@ -552,9 +556,9 @@ static void render_xml(test_batch_runner *runner) {
552
556
STR_EQ (runner , xml , "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
553
557
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
554
558
"<paragraph sourcepos=\"1:1-1:9\">\n"
555
- " <text sourcepos=\"1:1-1:4\">foo </text>\n"
559
+ " <text sourcepos=\"1:1-1:4\" xml:space=\"preserve\" >foo </text>\n"
556
560
" <emph sourcepos=\"1:5-1:9\">\n"
557
- " <text sourcepos=\"1:6-1:8\">bar</text>\n"
561
+ " <text sourcepos=\"1:6-1:8\" xml:space=\"preserve\" >bar</text>\n"
558
562
" </emph>\n"
559
563
"</paragraph>\n" ,
560
564
"render first paragraph with source pos" );
@@ -902,41 +906,41 @@ static void source_pos(test_batch_runner *runner) {
902
906
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
903
907
"<document sourcepos=\"1:1-10:20\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
904
908
" <heading sourcepos=\"1:1-1:13\" level=\"1\">\n"
905
- " <text sourcepos=\"1:3-1:5\">Hi </text>\n"
909
+ " <text sourcepos=\"1:3-1:5\" xml:space=\"preserve\" >Hi </text>\n"
906
910
" <emph sourcepos=\"1:6-1:12\">\n"
907
- " <text sourcepos=\"1:7-1:11\">there</text>\n"
911
+ " <text sourcepos=\"1:7-1:11\" xml:space=\"preserve\" >there</text>\n"
908
912
" </emph>\n"
909
- " <text sourcepos=\"1:13-1:13\">.</text>\n"
913
+ " <text sourcepos=\"1:13-1:13\" xml:space=\"preserve\" >.</text>\n"
910
914
" </heading>\n"
911
915
" <paragraph sourcepos=\"3:1-4:42\">\n"
912
- " <text sourcepos=\"3:1-3:14\">Hello “ </text>\n"
916
+ " <text sourcepos=\"3:1-3:14\" xml:space=\"preserve\" >Hello “ </text>\n"
913
917
" <link sourcepos=\"3:15-3:37\" destination=\"http://www.google.com\" title=\"\">\n"
914
- " <text sourcepos=\"3:16-3:36\">http://www.google.com</text>\n"
918
+ " <text sourcepos=\"3:16-3:36\" xml:space=\"preserve\" >http://www.google.com</text>\n"
915
919
" </link>\n"
916
920
" <softbreak />\n"
917
- " <text sourcepos=\"4:1-4:6\">there </text>\n"
918
- " <code sourcepos=\"4:8-4:9\">hi</code>\n"
919
- " <text sourcepos=\"4:11-4:14\"> -- </text>\n"
921
+ " <text sourcepos=\"4:1-4:6\" xml:space=\"preserve\" >there </text>\n"
922
+ " <code sourcepos=\"4:8-4:9\" xml:space=\"preserve\" >hi</code>\n"
923
+ " <text sourcepos=\"4:11-4:14\" xml:space=\"preserve\" > -- </text>\n"
920
924
" <link sourcepos=\"4:15-4:41\" destination=\"www.google.com\" title=\"ok\">\n"
921
- " <text sourcepos=\"4:16-4:19\">okay</text>\n"
925
+ " <text sourcepos=\"4:16-4:19\" xml:space=\"preserve\" >okay</text>\n"
922
926
" </link>\n"
923
- " <text sourcepos=\"4:42-4:42\">.</text>\n"
927
+ " <text sourcepos=\"4:42-4:42\" xml:space=\"preserve\" >.</text>\n"
924
928
" </paragraph>\n"
925
929
" <block_quote sourcepos=\"6:1-10:20\">\n"
926
930
" <list sourcepos=\"6:3-10:20\" type=\"ordered\" start=\"1\" delim=\"period\" tight=\"false\">\n"
927
931
" <item sourcepos=\"6:3-8:1\">\n"
928
932
" <paragraph sourcepos=\"6:6-7:10\">\n"
929
- " <text sourcepos=\"6:6-6:10\">Okay.</text>\n"
933
+ " <text sourcepos=\"6:6-6:10\" xml:space=\"preserve\" >Okay.</text>\n"
930
934
" <softbreak />\n"
931
- " <text sourcepos=\"7:6-7:10\">Sure.</text>\n"
935
+ " <text sourcepos=\"7:6-7:10\" xml:space=\"preserve\" >Sure.</text>\n"
932
936
" </paragraph>\n"
933
937
" </item>\n"
934
938
" <item sourcepos=\"9:3-10:20\">\n"
935
939
" <paragraph sourcepos=\"9:6-10:20\">\n"
936
- " <text sourcepos=\"9:6-9:15\">Yes, okay.</text>\n"
940
+ " <text sourcepos=\"9:6-9:15\" xml:space=\"preserve\" >Yes, okay.</text>\n"
937
941
" <softbreak />\n"
938
942
" <image sourcepos=\"10:6-10:20\" destination=\"hi\" title=\"yes\">\n"
939
- " <text sourcepos=\"10:8-10:9\">ok</text>\n"
943
+ " <text sourcepos=\"10:8-10:9\" xml:space=\"preserve\" >ok</text>\n"
940
944
" </image>\n"
941
945
" </paragraph>\n"
942
946
" </item>\n"
@@ -960,11 +964,11 @@ static void ref_source_pos(test_batch_runner *runner) {
960
964
"<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
961
965
"<document sourcepos=\"1:1-3:40\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
962
966
" <paragraph sourcepos=\"1:1-1:28\">\n"
963
- " <text sourcepos=\"1:1-1:10\">Let's try </text>\n"
967
+ " <text sourcepos=\"1:1-1:10\" xml:space=\"preserve\" >Let's try </text>\n"
964
968
" <link sourcepos=\"1:11-1:21\" destination=\"https://github.com\" title=\"GitHub\">\n"
965
- " <text sourcepos=\"1:12-1:20\">reference</text>\n"
969
+ " <text sourcepos=\"1:12-1:20\" xml:space=\"preserve\" >reference</text>\n"
966
970
" </link>\n"
967
- " <text sourcepos=\"1:22-1:28\"> links.</text>\n"
971
+ " <text sourcepos=\"1:22-1:28\" xml:space=\"preserve\" > links.</text>\n"
968
972
" </paragraph>\n"
969
973
"</document>\n" ,
970
974
"sourcepos are as expected" );
0 commit comments