comparison markdown_converter/README.md @ 195:f8f5004a920a

Merging back hg-web-tip
author MrJuneJune <me@mrjunejune.com>
date Tue, 27 Jan 2026 06:51:44 -0800
parents b818a4561a3c
children
comparison
equal deleted inserted replaced
189:14cc84ba35a0 195:f8f5004a920a
1 # markdown_converter
2
3 Markdown to HTML converter written in C, with WASM support for browser use.
4
5 ## Features
6
7 - Headings, paragraphs, lists
8 - Code blocks with syntax highlighting
9 - Links and images
10 - Bold, italic, inline code
11 - Blockquotes
12
13 ## Files
14
15 | File | Description |
16 |------|-------------|
17 | `markdown_to_html.h` | Public API header |
18 | `markdown_to_html.c` | C implementation |
19 | `markdown_to_html.js` | JavaScript wrapper for WASM |
20 | `markdown_to_html.css` | Default styles |
21 | `tests/` | Test cases |
22
23 ## Usage (C)
24
25 ```c
26 #include "markdown_converter/markdown_to_html.h"
27
28 char* html = markdown_to_html(markdown_string);
29 // use html...
30 markdown_free(html);
31 ```
32
33 ## Usage (WASM/JavaScript)
34
35 ```javascript
36 import createModule from 'markdown_converter/markdown_to_html_wasm/markdown_to_html_bin.js';
37
38 const Module = await createModule();
39 const toHtml = Module.cwrap('markdown_to_html', 'number', ['string']);
40 const free = Module.cwrap('markdown_free', null, ['number']);
41
42 const ptr = toHtml(markdownString);
43 const html = Module.UTF8ToString(ptr);
44 free(ptr);
45 ```
46
47 ## Building
48
49 ```bash
50 bazel build //markdown_converter:markdown_to_html
51 bazel build //markdown_converter:markdown_to_html_wasm # WASM version
52 ```