@ox-content/wasm
v2.27.0
Published
WebAssembly bindings for Ox Content - Browser-ready Markdown parser
Maintainers
Readme
@ox-content/wasm
WebAssembly bindings for Ox Content's Rust Markdown engine.
Use this package when you want to run Ox Content in the browser, a Web Worker, or another JavaScript environment that can load .wasm from ESM.
If you are building for Node.js, prefer @ox-content/napi.
Installation
pnpm add @ox-content/wasmUsage
import init, { parseAndRender, WasmParserOptions } from "@ox-content/wasm";
await init();
const options = new WasmParserOptions();
options.gfm = true;
options.tables = true;
options.taskLists = true;
const result = parseAndRender("# Hello from WASM", options);
console.log(result.html);API
The current WebAssembly surface exposes:
parseAndRender(source, options?)transform(source, options?)version()WasmParserOptions
Notes
- The generated module is ESM-only.
- The default
init()call loadsox_content_wasm_bg.wasmrelative to the package entry. - For server-side Node.js usage, use
@ox-content/napiinstead.
Local Build
From the repository root:
vp run build:wasm
pnpm --filter @ox-content/wasm pack --dry-runThis generates a publish-ready package in crates/ox_content_wasm/pkg/.
First Local Publish
Use pnpm --filter from the workspace root so you do not accidentally target the wrong package:
pnpm whoami || pnpm login
pnpm --filter @ox-content/wasm publish --access public --no-git-checksAvoid pnpm -r publish here, because that would try to publish every publishable package in the workspace.
