cld-ssg

The static site generator (to be) used for hellocld.com
git clone git://git.hellocld.com/cld-ssg
Log | Files | Refs

commit 356a91ba9f0265d6b7f9307241b7a4fbc96c99cc
parent 6adf8bdc1b674bc9961b3c2a049518897cada8fc
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Tue, 24 Sep 2019 13:10:58 -0400

Switched over to using node gen for creating content

Keeps calls a bit simpler and reduces parsing (I think)

Diffstat:
Mmain.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c @@ -81,15 +81,18 @@ struct post *create_post(const char *path) { struct post *p = malloc(sizeof(struct post)); + /* read in the post text file */ char *tmp = read_text(path, MAX_POST_CHARS); + struct cmark_node *t_root = cmark_parse_document(tmp, strlen(tmp), CMARK_OPT_DEFAULT); + free(tmp); /* convert the markdown to html */ - p->content = cmark_markdown_to_html(tmp, strlen(tmp), CMARK_OPT_DEFAULT); + p->content = cmark_render_html(t_root, CMARK_OPT_DEFAULT); - p->title = get_title(cmark_parse_document(tmp, strlen(tmp), CMARK_OPT_DEFAULT)); + p->title = get_title(t_root); - free(tmp); + free(t_root); return p; }