summaryrefslogtreecommitdiff
path: root/src/cmark.c
blob: 064c08038fd3a35d15db3f4411f945c899e17679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}