-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad064b2
commit 524c553
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|