Skip to content

Commit

Permalink
docs(cookery): ref in get started section
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Oct 29, 2023
1 parent 0a786f8 commit 3016168
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions docs/cookery/get-started.typ
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ const getModule = () => WebAssembly.instantiate(/* params */);
const getModule = async () => {/* above four ways */};
```

== Run the compiler or renderer with simplified APIs

The most simple examples always work with the all-in-one JavaScript Library:

```ts
import { $typst } from '@myriaddreamin/typst.ts/dist/esm/contrib/snippet.mjs';
console.log((await $typst.svg({
mainContent: 'Hello, typst!' })).length);
// :-> 7317
```

See #link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/all-in-one.html")[All-in-one (Simplified) JavaScript Library] for more example usage.

Once you feel more conformtable, please continue reading following sections.

== Configure and run compiler <run-compiler>

- Configure font resources
Expand Down
4 changes: 3 additions & 1 deletion docs/cookery/guide/all-in-one.typ
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Note: the compilation is already cached by typst's `comemo` implicitly.

== Specify extra init options

The extra init options must be at the start of the main routine, or accurately before all invocations.
Ideally, you don't have to specify any options. But if necessary, the extra init options must be at the start of the main routine, or accurately before all invocations.

```ts
// Example: cache default fonts to file system
Expand All @@ -142,6 +142,8 @@ $typst.setPdfjsModule(pdfJsLib);
await $typst.svg({ mainContent });
```

Note: There are more documentation about initialization in the *Import typst.ts to your project* section of #link("https://myriad-dreamin.github.io/typst.ts/cookery/get-started.html")[Get started with Typst.ts].

== Specify extra render options

See #link(snippet-source)[comments on source] for more details.

0 comments on commit 3016168

Please sign in to comment.