1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! WebAssembly bindings for pdfrs
//!
//! This module exposes the PDF generation pipeline to JavaScript environments
//! via `wasm-bindgen`. All functions are pure in-memory — no filesystem access.
//!
//! # Build
//!
//! ```bash
//! wasm-pack build . --target web --out-dir wasm/pkg --features wasm --no-default-features
//! ```
//!
//! # Usage (JavaScript)
//!
//! ```js
//! import init, { render_markdown_to_pdf } from './pkg/pdfrs.js';
//!
//! await init();
//! const pdfBytes = render_markdown_to_pdf("# Hello WASM\n\nIt works!");
//! // pdfBytes is a Uint8Array
//! ```
use *;
/// Render Markdown to PDF bytes in a WebAssembly environment.
///
/// Takes a Markdown string and returns the raw PDF byte vector.
/// This function does **not** touch the filesystem — everything happens
/// in memory, making it ideal for browser or serverless WASM runtimes.
///
/// # Example (JavaScript)
///
/// ```js
/// import init, { render_markdown_to_pdf } from './pkg/pdfrs.js';
///
/// async function run() {
/// await init();
/// const pdfBytes = render_markdown_to_pdf("# Hello WASM\n\nIt works!");
/// // pdfBytes is a Uint8Array
/// }
/// ```