diff options
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); +} |