|
6 | 6 |
|
7 | 7 | A generator that builds a website from a documentation JSON file generated by typst-docs.
|
8 | 8 |
|
| 9 | +## Required toolchains |
| 10 | + |
| 11 | +- [Node.js](https://nodejs.org/) |
| 12 | +- [Bun](https://bun.sh/) |
| 13 | + |
| 14 | +Using [mise](https://mise.jdx.dev/) is recommended, as it enables central management of all the toolchains required for both the SSG and the upstream typst-docs. |
| 15 | + |
| 16 | +```toml |
| 17 | +# mise.toml |
| 18 | +[tools] |
| 19 | +rust = "1.83.0" # set required version for typst-docs |
| 20 | +node = "22.11.0" |
| 21 | +bun = "1.2.21" |
| 22 | +``` |
| 23 | + |
| 24 | +## Setup |
| 25 | + |
| 26 | +The typst-docs CLI outputs the static files required for building the documentation. Place the JSON file and assets generated by typst-docs in the `/public/` directory. In most use cases, symbolic links are convenient. |
| 27 | + |
| 28 | +```sh |
| 29 | +# Run in the root directory of typst/typst repository |
| 30 | +cargo run --package typst-docs -- --assets-dir assets --out-file docs.json --base /docs/ |
| 31 | +``` |
| 32 | + |
| 33 | +```plaintext |
| 34 | +public |
| 35 | +├── assets ⇒ /path/to/typst/assets |
| 36 | +└── docs.json ⇒ /path/to/typst/docs.json |
| 37 | +``` |
| 38 | + |
| 39 | +Create `/public/metadata.json` and describe the metadata for the documentation website. For details on each property, refer to the JSON schema. For example: |
| 40 | + |
| 41 | +```json |
| 42 | +{ |
| 43 | + "$schema": "/path/to/typst-docs-web/metadata.schema.json", |
| 44 | + "language": "ja-JP", |
| 45 | + "version": "0.13.1", |
| 46 | + "typstOfficialUrl": "https://typst.app", |
| 47 | + "typstOfficialDocsUrl": "https://typst.app/docs/", |
| 48 | + "githubOrganizationUrl": "https://github.com/typst-jp", |
| 49 | + "githubRepositoryUrl": "https://github.com/typst-jp/docs", |
| 50 | + "discordServerUrl": "https://discord.gg/9xF7k4aAuH", |
| 51 | + "originUrl": "https://typst-jp.github.io/", |
| 52 | + "basePath": "/docs/", |
| 53 | + "displayTranslationStatus": true |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +`/public/translation-status.json` is used to manage the translation progress and the classification of original content. This file is automatically updated when running the SSG, so manual editing is not necessary. |
| 58 | + |
9 | 59 | ## Commands
|
10 | 60 |
|
| 61 | +After installing dependencies with Bun, the following commands are available: |
| 62 | + |
| 63 | +```sh |
| 64 | +bun install --frozen-lockfile |
| 65 | +``` |
| 66 | + |
11 | 67 | ### Develop
|
12 | 68 |
|
13 | 69 | > [!NOTE]
|
|
0 commit comments