Skip to content

Commit 71e27f2

Browse files
committed
Footnotes now support being nested, i.e. a footnote may reference another footnote.
1 parent 85d8952 commit 71e27f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/blocks.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ static void process_footnotes(cmark_parser *parser) {
468468
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
469469
cur = cmark_iter_get_node(iter);
470470
if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_DEFINITION) {
471-
cmark_node_unlink(cur);
472471
cmark_footnote_create(map, cur);
473472
}
474473
}
@@ -515,8 +514,10 @@ static void process_footnotes(cmark_parser *parser) {
515514
qsort(map->sorted, map->size, sizeof(cmark_map_entry *), sort_footnote_by_ix);
516515
for (unsigned int i = 0; i < map->size; ++i) {
517516
cmark_footnote *footnote = (cmark_footnote *)map->sorted[i];
518-
if (!footnote->ix)
517+
if (!footnote->ix) {
518+
cmark_node_unlink(footnote->node);
519519
continue;
520+
}
520521
cmark_node_append_child(parser->root, footnote->node);
521522
footnote->node = NULL;
522523
}

0 commit comments

Comments
 (0)