Convert documents in Python and Node without a subprocess

Weavon runs inside your Python or Node.js process with no pandoc binary, no subprocess overhead, and a typed AST for filters.

Python and drop-in pypandoc

The Python package calls libweavon_c through standard ctypes with zero third-party packages. Switch one import line to move existing pypandoc calls into the process.

from weavon import compat as pypandoc

html = pypandoc.convert_text("# Hello", "html", format="md")
pypandoc.convert_file("report.md", "pdf", outputfile="report.pdf")

Need native operations? Import weavon directly for diff, chunk, lint, and typed bottom-up AST filters with parse, walk, and render.

Node.js, TypeScript, and Vite

The Node package runs the WebAssembly module on Node.js 22 or later with zero npm dependencies and full TypeScript AST types. The weavon/vite plugin turns Markdown imports into ES modules.

import { loadWeavon, walk, strong } from "weavon";

const weavon = await loadWeavon();
const doc = weavon.parse("Visit *world*.", { from: "markdown" });
const out = weavon.render(walk(doc, { inline: (n) => (n.t === "Emph" ? strong(n.c) : undefined) }), { to: "html" });
// vite.config.js
import { weavonPlugin } from "weavon/vite";
export default { plugins: [weavonPlugin()] };

Why in-process calls matter

  • 9.62 ms100 KB Markdown in Node.js
  • 6.48 ms100 KB CommonMark in Node.js
  • 64 MiBSandboxed C ABI buffer limit
  • 0 depsNo pip or npm dependencies

Install the Python or Node package

  1. Install the Python package

    Install prebuilt wheels with bundled libweavon_c from PyPI. No Rust toolchain or WEAVON_LIB_PATH is needed.

    pip install weavon
  2. Install the Node.js package

    Install weavon from npm with weavon_wasm.wasm bundled and zero npm dependencies.

    npm install weavon
  3. Run a typed filter in process

    Parse, walk, and render without spawning a separate filter executable.

    python3 -c 'import weavon; print(weavon.convert("*Fast*", "html", "markdown"))'

Common questions

How does Weavon replace pypandoc?

Change your import to from weavon import compat as pypandoc. convert_text, convert_file, and get_pandoc_version run in-process via ctypes with no pandoc binary.

Does the Python package require compiled Cython or PyO3 wheels?

No. It uses Python's standard ctypes module to call the bundled libweavon_c library with zero third-party Python dependencies.

Which Node.js version does the weavon npm package require?

It requires Node.js 22 or later, bundles weavon_wasm.wasm, ships full TypeScript types, and has zero npm dependencies.

Can I write Pandoc AST filters in Python or TypeScript?

Yes. Both bindings provide parse, bottom-up walk, node constructors, and render inside your host process.