comparison markdown_converter/markdown_to_html.h @ 154:bdcc610eeed8

[Markdown Converter][GuiZe] Added markdown coverter in C and wasm rule sets. Needs further view on this as I haven't taken a look. Written by Claude.
author June Park <parkjune1995@gmail.com>
date Mon, 12 Jan 2026 09:11:58 -0800
parents
children
comparison
equal deleted inserted replaced
153:790930d9bb90 154:bdcc610eeed8
1 #ifndef MARKDOWN_TO_HTML_H
2 #define MARKDOWN_TO_HTML_H
3
4 #include <stddef.h>
5
6 // Export macro for WASM/Emscripten
7 #ifdef __EMSCRIPTEN__
8 #include <emscripten.h>
9 #define MDAPI EMSCRIPTEN_KEEPALIVE
10 #else
11 #ifdef _WIN32
12 #ifdef MARKDOWN_EXPORTS
13 #define MDAPI __declspec(dllexport)
14 #else
15 #define MDAPI __declspec(dllimport)
16 #endif
17 #else
18 #define MDAPI extern
19 #endif
20 #endif
21
22 /**
23 * Convert markdown string to HTML string.
24 *
25 * @param markdown The input markdown string (null-terminated)
26 * @return Newly allocated HTML string. Caller must free with markdown_free().
27 * Returns NULL on allocation failure.
28 *
29 * Supported markdown features:
30 * - Headers: # H1, ## H2, ... ###### H6
31 * - Bold: **text** or __text__
32 * - Italic: *text* or _text_
33 * - Strikethrough: ~~text~~
34 * - Links: [text](url)
35 * - Images: ![alt](url)
36 * - Inline code: `code`
37 * - Code blocks: ```code```
38 * - Unordered lists: -, *, +
39 * - Ordered lists: 1., 2., etc.
40 * - Blockquotes: > text
41 * - Horizontal rules: ---, ***, ___
42 */
43 MDAPI char *markdown_to_html(const char *markdown);
44
45 /**
46 * Free HTML string returned by markdown_to_html.
47 *
48 * @param html The HTML string to free
49 */
50 MDAPI void markdown_free(char *html);
51
52 /**
53 * Get length of HTML string (useful for WASM memory operations).
54 *
55 * @param html The HTML string
56 * @return Length of the string, or 0 if NULL
57 */
58 MDAPI size_t markdown_get_length(const char *html);
59
60 #endif // MARKDOWN_TO_HTML_H