aboutsummaryrefslogtreecommitdiff
path: root/src/cmark.c
blob: ef98d79cad3eb0d1cf4d2df9d62b3075aff8a845 (plain)
  1. #include <stdlib.h>
  2. #include <assert.h>
  3. #include <stdio.h>
  4. #include "cmark.h"
  5. #include "buffer.h"
  6. extern unsigned char *cmark_markdown_to_html(unsigned char *text, int len)
  7. {
  8. node_block *blocks;
  9. strbuf htmlbuf = GH_BUF_INIT;
  10. unsigned char *result;
  11. blocks = cmark_parse_document(text, len);
  12. cmark_render_html(&htmlbuf, blocks);
  13. cmark_free_nodes(blocks);
  14. result = strbuf_detach(&htmlbuf);
  15. strbuf_free(&htmlbuf);
  16. return result;
  17. }