@tmke8/pikru
v1.2.1
Published
WASM bindings for pikru - renders Pikchr diagrams to SVG
Readme
pikru-node
WASM bindings for pikru, a Rust library that renders Pikchr diagrams to SVG.
Installation
npm install @tmke8/pikruUsage
import { Pikru } from '@tmke8/pikru';
const pikru = new Pikru();
const svg = pikru.render('box "Hello"; arrow; box "World"');Options
The Pikru constructor accepts an optional options object:
const pikru = new Pikru({ cssVariables: false, explicitSize: false });| Option | Type | Default | Description |
|----------------|-----------|---------|------------------------------------------------------------------|
| cssVariables | boolean | false | Use CSS variables for colors, enabling light/dark mode support. |
| explicitSize | boolean | false | Add explicit width and height attributes to the SVG element. |
Development
Building
Building requires wasm-bindgen.
Build the Node.js package:
cd node
npm install
npm run buildBuild for web (requires wasm-opt for binary size optimization):
make playgroundTesting
cd node
npm testPlayground
A simple test page is included in the playground/ directory:
python3 -m http.server 8000 --directory playgroundThen open http://localhost:8000 in your browser.
