summaryrefslogtreecommitdiff
path: root/src/cmark.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmark.h')
-rw-r--r--src/cmark.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmark.h b/src/cmark.h
index 45bc338..84a15c8 100644
--- a/src/cmark.h
+++ b/src/cmark.h
@@ -163,6 +163,11 @@ cmark_node_last_child(cmark_node *node);
*
* cmark_iter_free(iter);
* }
+ *
+ * Note that if you delete the current node, its first child, or its
+ * next sibling, the iterator may point to a nonexistent note.
+ * Use 'cmark_iter_reset' to set its pointer to the next node that
+ * should be traversed.
*/
/** Creates a new iterator starting at 'root'.
@@ -177,6 +182,15 @@ CMARK_EXPORT
void
cmark_iter_free(cmark_iter *iter);
+/** Resets the iterator so that the current node is 'current' and
+ the event type is 'event_type'. Use this to resume after destructively
+ modifying the tree structure.
+ */
+CMARK_EXPORT
+void
+cmark_iter_reset(cmark_iter *iter, cmark_node *current,
+ cmark_event_type event_type);
+
/** Returns the event type (`CMARK_EVENT_ENTER`, `CMARK_EVENT_EXIT`,
* or `CMARK_EVENT_DONE`) for the next node.
*/