From cb744bd09103321b18ee979edac2cb26a414f7be Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 11 Nov 2014 12:00:42 -0800 Subject: Added cmark_markdown_to_html with a simple interface. See #70. --- src/cmark.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/cmark.c (limited to 'src/cmark.c') diff --git a/src/cmark.c b/src/cmark.c new file mode 100644 index 0000000..064c080 --- /dev/null +++ b/src/cmark.c @@ -0,0 +1,19 @@ +#include +#include +#include + +#include "cmark.h" +#include "buffer.h" + +extern unsigned char *cmark_markdown_to_html(unsigned char *text) +{ + node_block *blocks; + strbuf htmlbuf = GH_BUF_INIT; + + blocks = cmark_parse_document(text, sizeof(text)); + + cmark_render_html(&htmlbuf, blocks); + cmark_free_nodes(blocks); + + return strbuf_detach(&htmlbuf); +} -- cgit v1.2.3