Mercurial
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/markdown_converter/README.md Tue Jan 27 06:51:44 2026 -0800 @@ -0,0 +1,52 @@ +# markdown_converter + +Markdown to HTML converter written in C, with WASM support for browser use. + +## Features + +- Headings, paragraphs, lists +- Code blocks with syntax highlighting +- Links and images +- Bold, italic, inline code +- Blockquotes + +## Files + +| File | Description | +|------|-------------| +| `markdown_to_html.h` | Public API header | +| `markdown_to_html.c` | C implementation | +| `markdown_to_html.js` | JavaScript wrapper for WASM | +| `markdown_to_html.css` | Default styles | +| `tests/` | Test cases | + +## Usage (C) + +```c +#include "markdown_converter/markdown_to_html.h" + +char* html = markdown_to_html(markdown_string); +// use html... +markdown_free(html); +``` + +## Usage (WASM/JavaScript) + +```javascript +import createModule from 'markdown_converter/markdown_to_html_wasm/markdown_to_html_bin.js'; + +const Module = await createModule(); +const toHtml = Module.cwrap('markdown_to_html', 'number', ['string']); +const free = Module.cwrap('markdown_free', null, ['number']); + +const ptr = toHtml(markdownString); +const html = Module.UTF8ToString(ptr); +free(ptr); +``` + +## Building + +```bash +bazel build //markdown_converter:markdown_to_html +bazel build //markdown_converter:markdown_to_html_wasm # WASM version +```