https://github.com/andredalbosco/wypst
Typst math typesetting for the web.
https://github.com/andredalbosco/wypst
katex math rust typesetting typst wasm
Last synced: 4 months ago
JSON representation
Typst math typesetting for the web.
- Host: GitHub
- URL: https://github.com/andredalbosco/wypst
- Owner: andredalbosco
- License: mit
- Created: 2023-12-05T14:06:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-04T11:18:48.000Z (about 1 year ago)
- Last Synced: 2026-03-02T20:45:47.001Z (5 months ago)
- Topics: katex, math, rust, typesetting, typst, wasm
- Language: JavaScript
- Homepage: https://0xpapercut.github.io/wypst/
- Size: 37.5 MB
- Stars: 90
- Watchers: 4
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# wypst
Typst math typesetting for the web.
## Current Project Status
I feel like there's something like 20% of work left to get Wypst in a more stable state, but for some months now I haven't been able to allocate the necessary time to do it.
There's still no conclusive roadmap for native HTML export in Typst, and because this project gained some traction, I'll make a commitment to complete all unimplemented functionality, fix issues, and add whatever is needed to achieve equivalency of `obsidian-wypst` to `obsidian-typst`.
## Usage
You can load this library either by using a script tag, or installing it with npm.
### Script tag (simple usage)
```html
wypst.initialize().then(() => {
wypst.renderToString("x + y"); // Test it out!
})
```
Keep in mind that the javascript file is 17M, so if your internet is slow it might take some seconds to load.
### npm package (advanced usage)
If having the wasm inlined directly is an incovenience, install the npm package
```bash
npm install wypst
```
You may then load the wasm binary
```javascript
import wypst from 'wypst';
import wasm from 'wypst/dist/wypst.wasm';
await wypst.initialize(wasm);
wypst.renderToString("x + y"); // Test it out!
```
Keep in mind that you will probably need to tell your bundler how to load a `.wasm` file. If you have difficulties you can open an issue.
### Rendering Typst Math
To render a Typst math expression, you can use either `render` or `renderToString`, as the example below shows:
```javascript
wypst.render('sum_(n >= 1) 1/n^2 = pi^2/6', element); // Renders into the HTML element
wypst.renderToString('sum_(n >= 1) 1/n^2 = pi^2/6'); // Renders into an HTML string
```
## Contributing
All help is welcome. Please see [CONTRIBUTING](CONTRIBUTING.md).