Skip to content
ironmark

C and C++

The crate compiles to a static library (libironmark.a) that exposes two C functions. A header is provided at include/ironmark.h.

Build the library

cargo build --release
# output: target/release/libironmark.a
# Linux
cc -o example example.c -L target/release -l ironmark -lpthread -ldl
 
# macOS
cc -o example example.c -L target/release -l ironmark \
   -framework CoreFoundation -framework Security

Call it

#include "include/ironmark.h"
#include <stdio.h>
 
int main(void) {
    char *html = ironmark_render_html("# Hello\n\nThis is **fast**.");
    if (html) {
        printf("%s\n", html);
        ironmark_free(html);
    }
    return 0;
}

Memory contract

Both functions are null-safe: ironmark_render_html(NULL) returns NULL, and ironmark_free(NULL) is a no-op.

Parsing always uses the default ParseOptions (all extensions enabled, disable_raw_html off). Options are not yet configurable through the C API.