cmark

My personal build of CMark ✏️

Commit
f904f701cf4390b4d5531c5626c5cf08d85a913f
Parent
d55f1130acf9708de4f74556767251f8ed85e356
Author
John MacFarlane <jgm@berkeley.edu>
Date

Fixed cases like

``` [ref]: url "title" ok ```

Here we should parse the first line as a reference.

Diffstat

1 file changed, 9 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 10 9 1
diff --git a/src/inlines.c b/src/inlines.c
@@ -1196,7 +1196,15 @@ bufsize_t cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map 
 	// parse final spaces and newline:
 	skip_spaces(&subj);
 	if (!skip_line_end(&subj)) {
-		return 0;
+		if (matchlen) { // try rewinding before title
+			subj.pos = beforetitle;
+			skip_spaces(&subj);
+			if (!skip_line_end(&subj)) {
+				return 0;
+			}
+		} else {
+			return 0;
+		}
 	}
 	// insert reference into refmap
 	cmark_reference_create(refmap, &lab, &url, &title);