From 052ca127b01a9be6f1107c8d26b1f81dc83dc46a Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Mon, 21 Dec 2020 00:25:20 -0500 Subject: [PATCH] handling header blocks --- parser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/parser.c b/parser.c index 3c28349..1c3cb13 100644 --- a/parser.c +++ b/parser.c @@ -36,12 +36,12 @@ const MD_PARSER parser = { int main(int argc, char** argv) { - char* input_buffer; + const char* input_buffer; long input_size; input_buffer = read_file("test_board.md", &input_size); - md_parse(input_buffer, input_size, &parser, NULL); + int out = md_parse(input_buffer, input_size, &parser, NULL); return 0; } @@ -84,6 +84,13 @@ read_file(char* file_name, long* size) int enter_block(MD_BLOCKTYPE type, void* detail, void* userdata) { + switch (type) { + case MD_BLOCK_H: + printf("Found h%d block\n", ((MD_BLOCK_H_DETAIL*)detail)->level); + break; + + // no need for default case for now :> + } return 0; } @@ -113,6 +120,7 @@ text(MD_TEXTTYPE type, const MD_CHAR* text, MD_SIZE size, void* userdata){ void debug_log(const char* msg, void* userdata) { + printf(msg); return; } -- 2.20.1