view markdown_converter/README.md @ 211:a6d8d32a0261

[MrJuneJune] Simple animations for darkmode.
author MrJuneJune <me@mrjunejune.com>
date Sun, 15 Feb 2026 21:38:23 -0800
parents b818a4561a3c
children
line wrap: on
line source

# 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
```