Skip to content

Commit

Permalink
docs: update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Oct 3, 2024
1 parent f540cb3 commit becc081
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
7 changes: 4 additions & 3 deletions docs/cookery/book.typ
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
- #chapter("guide/renderer/ts-lib.typ", section: "4.1")[JavaScript/TypeScript Library]
- #chapter("guide/renderer/node.typ", section: "4.2")[Node.js Library]
- #chapter("guide/renderer/react.typ", section: "4.3")[React Library]
- #chapter("guide/renderer/angular.typ", section: "4.4")[Angular Library]
- #chapter("guide/renderer/vue3.typ", section: "4.5")[Vue3 Library]
- #chapter("guide/renderer/hexo.typ", section: "4.6")[Hexo Plugin]
- #chapter("guide/renderer/solid.typ", section: "4.4")[Solid Library]
- #chapter("guide/renderer/angular.typ", section: "4.5")[Angular Library]
- #chapter("guide/renderer/vue3.typ", section: "4.6")[Vue3 Library]
- #chapter("guide/renderer/hexo.typ", section: "4.7")[Hexo Plugin]
- #chapter("guide/trouble-shooting.typ", section: "5")[Trouble Shooting]
// = Advanced development
// - #chapter("guide/env-setup.typ", section: "5")[Environment Setup]
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/ebook.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "@preview/shiroa:0.1.0": *
#import "@preview/shiroa:0.1.1": *

#import "/docs/cookery/templates/ebook.typ"

Expand Down
4 changes: 1 addition & 3 deletions docs/cookery/guide/renderer/angular.typ
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ Render the document with artifact from precompiler.
</typst-document>
```

The artifact can be only in #term.vector-format to this time.

To get `artifact` data, please refer to #term.ts-cli.
#include "get-artifact.typ"

=== Set renderer initialization option for `typst-document`

Expand Down
5 changes: 5 additions & 0 deletions docs/cookery/guide/renderer/get-artifact.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "/docs/cookery/term.typ" as term

The artifact can be only in #term.vector-format to this time.

To get `artifact` data, please refer to #term.ts-cli or #term.node-js-lib.
4 changes: 1 addition & 3 deletions docs/cookery/guide/renderer/react.typ
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ Render the document with artifact from precompiler.
<TypstDocument artifact={artifact}/>
```

The artifact can be only in #term.vector-format to this time.

To get `artifact` data, please refer to #term.ts-cli.
#include "get-artifact.typ"

=== Set renderer initialization option for `TypstDocument`

Expand Down
6 changes: 2 additions & 4 deletions docs/cookery/guide/renderer/solid.typ
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ Render the document with artifact from precompiler.
<TypstDocument artifact={artifact}/>
```

The artifact can be only in #term.vector-format to this time.

To get `artifact` data, please refer to #term.ts-cli.
#include "get-artifact.typ"

=== Set renderer initialization option for `TypstDocument`

Expand All @@ -67,7 +65,7 @@ The default value is:
```ts
{
beforeBuild: [],
getModule: () => '/node_modules/@myriaddreamin/typst-ts-renderer/pkg/typst_ts_renderer_bg.wasm',
getModule: () => 'https://cdn.jsdelivr.net/npm/@myriaddreamin/typst-ts-renderer/pkg/typst_ts_renderer_bg.wasm',
}
```

Expand Down
4 changes: 3 additions & 1 deletion docs/cookery/guide/renderer/ts-lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ plugin

Please ensure that `/path/to/typst_ts_renderer_bg.wasm` is accessible to your frontend.

Next, load the artifact in #term.vector-format from somewhere. For example, precompile your doucment by #term.ts-cli and load it by the `fetch` api:
Next, load the artifact in #term.vector-format from somewhere. For example, load it by the `fetch` api:

```ts
const artifactContent: Uint8Array =
Expand All @@ -65,6 +65,8 @@ const artifactContent: Uint8Array =
.then(buffer => new Uint8Array(buffer));
```

#include "get-artifact.typ"

Finally, call the `render` api to trigger rendering:

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/templates/ebook.typ
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "@preview/shiroa:0.1.0": *
#import "@preview/shiroa:0.1.1": *
#import "/docs/cookery/templates/page.typ": project, part-style

#let _page-project = project
Expand Down
2 changes: 2 additions & 0 deletions docs/cookery/term.typ
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

#let ts-cli = link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/compiler/ts-cli.html")[Command Line Interface]

#let node-js-lib = link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/all-in-one-node.html")[All-in-one Node.js Library]

#let init-option = link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/packages/typst.ts/src/options.init.mts#L40")[`typst.InitOptions`]

0 comments on commit becc081

Please sign in to comment.