summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-11-25 15:54:27 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-11-25 15:54:27 -0800
commit7bc7581b22fbb2f77529a5ac9bca57ed1916bd32 (patch)
tree023a41962fbcd7142be5d5a31acc1a849675c3e6 /src/print.c
parent8ee6f28d2fe0d990da8bdd88579dcd8cc488d01b (diff)
Replaced cmark_debug_print with cmark_render_ast.
This returns a string.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index 9f1f233..d2dfe8c 100644
--- a/src/print.c
+++ b/src/print.c
@@ -158,9 +158,12 @@ static void render_nodes(strbuf* buffer, cmark_node* node, int indent)
}
}
-void cmark_debug_print(cmark_node *root)
+char *cmark_render_ast(cmark_node *root)
{
+ char* result;
strbuf buffer = GH_BUF_INIT;
render_nodes(&buffer, root, -2);
- printf("%s", buffer.ptr);
+ result = (char *)strbuf_detach(&buffer);
+ strbuf_free(&buffer);
+ return result;
}