Installation & Setup
New here?
Start with the Tutorial — it's hands-on and covers everything in this page through concrete examples.
Installation
bash
npm install relational-textRelationalText ships a pre-built WASM binary. No Rust toolchain required.
WASM Initialization
Call initRelationalText() once before any document operations. It is safe to call multiple times — initialization only happens once.
ts
import { initRelationalText } from 'relational-text'
await initRelationalText()In a test suite (Vitest / Jest):
ts
import { initRelationalText } from 'relational-text'
beforeAll(() => initRelationalText())With the bundler target (Vite, webpack, esbuild), the WASM module auto-initializes when imported, so the explicit call acts as a hook that ensures the module is fully loaded before you proceed.
First Example: Markdown to HTML
ts
import { initRelationalText, from, to } from 'relational-text'
await initRelationalText()
const doc = from('markdown', '**Hello**, _world_!')
const html = to('html', doc)
// '<p><strong>Hello</strong>, <em>world</em>!</p>\n'Next Steps
- Tutorial — hands-on walkthrough from zero to working pipeline
- How-To Guides — task-focused recipes
- Document Model — understand the wire format
- Formats Overview — see all supported formats
- Lenses — transform between namespaces
- API Reference — full TypeScript API
- Adding a Custom Format — extend RelationalText with your own format