diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-11-11 12:00:42 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-11-11 12:01:00 -0800 |
commit | cb744bd09103321b18ee979edac2cb26a414f7be (patch) | |
tree | 6a6837df1271598bf8bb056b03f1c41aa8195ffb /src/cmark.c | |
parent | f8d804300a134993a667ecf66063ee15accc6712 (diff) |
Added cmark_markdown_to_html with a simple interface.
See #70.
Diffstat (limited to 'src/cmark.c')
-rw-r--r-- | src/cmark.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 <stdlib.h> +#include <assert.h> +#include <stdio.h> + +#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); +} |