Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 3.33 KB

README.md

File metadata and controls

74 lines (56 loc) · 3.33 KB

Examples

Runnable programs for every Markkit surface. They need no network, read only inline strings and the sample files in data/, and run in CI on every change, so they always match the current API.

Sample documents

data/ holds a Word report (report.docx), a two-sheet workbook (sales.xlsx) and a one-page PDF (sample.pdf). They are tiny, contain no macros or external references, and are regenerated byte-for-byte by python3 examples/data/generate.py.

Rust

Run from the repository root:

Example Command Shows
basic.rs cargo run -p markkit --example basic HTML to Markdown with defaults
documents.rs cargo run -p markkit --example documents extract_document_sync: format detection, title, metadata, stats, warnings, unsupported formats
convert.rs cargo run -p markkit --features all_formats --example convert [-- FILE...] Convert DOCX, XLSX, PDF (or your own files)
main_content.rs cargo run -p markkit --example main_content Article detection, base_url, selectors
custom_selectors.rs cargo run -p markkit --example custom_selectors CSS include / exclude selectors
configuration.rs cargo run -p markkit --example configuration How builder options change output
limits.rs cargo run -p markkit --example limits Limits, Error::ResourceLimit, LimitKind handling
ir_access.rs cargo run -p markkit --example ir_access Parse to IR, walk nodes, render separately
transforms.rs cargo run -p markkit --example transforms Built-in and closure IR transforms
agent_tool.rs cargo run -p markkit --features tool --example agent_tool LLM tool definition, system prompt, execution

just examples runs them all.

Python

pip install markkit            # or, in this repo: maturin develop
python examples/python/quickstart.py
Example Shows
python/quickstart.py HTML, selectors and main content, asyncio functions
python/documents.py DOCX, XLSX, PDF with stats and warnings, PDF layout; pass your own files as arguments
python/limits.py markkit.Limits and error handling

Node.js

npm install @everruns/markkit
node examples/node/quickstart.cjs

Inside this repository, build the binding first (cd crates/markkit-js && npm install && npx napi build --release --platform) and point the examples at it with MARKKIT_MODULE=$PWD/crates/markkit-js.

Example Shows
node/quickstart.cjs HTML sync and async, options, bytes
node/documents.cjs DOCX, XLSX, PDF with stats, limits and layout; pass your own files as arguments

WebAssembly

just wasm                       # build crates/markkit-wasm/pkg
node examples/wasm/quickstart.mjs
Example Shows
wasm/quickstart.mjs initMarkkit, HTML, DOCX/XLSX/PDF bytes, the agent tool, limit errors

The same code runs in browsers and edge runtimes; only the file reading differs (use fetch and new Uint8Array(await res.arrayBuffer())).