From 4b5e43c4fa9e18b7a281063a98fbef0def5a1cbe Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 20 Jan 2015 18:11:23 +0100 Subject: Accessor for iterator's root node --- src/cmark.h | 6 ++++++ src/iterator.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/cmark.h b/src/cmark.h index 74fa4c7..8177fa8 100644 --- a/src/cmark.h +++ b/src/cmark.h @@ -213,6 +213,12 @@ CMARK_EXPORT cmark_event_type cmark_iter_get_event_type(cmark_iter *iter); +/** Returns the root node. + */ +CMARK_EXPORT +cmark_node* +cmark_iter_get_root(cmark_iter *iter); + /** Resets the iterator so that the current node is 'current' and * the event type is 'event_type'. The new current node must be a * descendant of the root node or the root node itself. diff --git a/src/iterator.c b/src/iterator.c index 4daec2d..eb7b49c 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -108,6 +108,12 @@ cmark_iter_get_event_type(cmark_iter *iter) return iter->cur.ev_type; } +cmark_node* +cmark_iter_get_root(cmark_iter *iter) +{ + return iter->root; +} + void cmark_consolidate_text_nodes(cmark_node *root) { -- cgit v1.2.3