Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpapercut committed May 3, 2024
1 parent ad064b2 commit 524c553
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
Typst math typesetting for the web.

## Usage
You can load this library either by using a script tag (preferred), or installing it with npm (for advanced usage).

### Option 1: Script tag
This is simplest way to load, and looks very similar to how you go about it with KaTeX. This is the preferred and simplest method.
You can load this library either by using a script tag, or installing it with npm.

### Script tag (simple usage)
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/wypst.min.css" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/wypst.min.js" crossorigin="anonymous"></script>

<script>
wypst.initialize();
wypst.renderToString(); // Test it out!
</script>
```

Keep in mind that the javascript file is 17M, so if your internet is slow it might take some seconds to load.

### Option 2: npm package
Sometimes having the wasm inlined in the script file is incovenient. When this is the case, you will have to install the package with npm.

### 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

```
import wypst from 'wypst';
import wasm from 'wypst/dist/wypst.wasm';
Expand Down

0 comments on commit 524c553

Please sign in to comment.