Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 77 additions & 5 deletions website/typst-docs-web/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,76 @@
# website
# typst-docs-web

<div align="center">
<img src="./images/preview.png" alt="">
</div>

Build a website from the documentation JSON file generated by [typst-docs](https://github.com/typst/typst/blob/main/docs/Cargo.toml#L2).

## Required toolchains

- [Node.js](https://nodejs.org/)
- [Bun](https://bun.sh/)

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.

```toml
# mise.toml
[tools]
rust = "1.83.0" # set required version for typst-docs
node = "22.11.0"
bun = "1.2.21"
```

## Setup

> [!NOTE]
> このドキュメントは執筆中です。
> The JSON structure generated by typst-docs is not stable and may change at any time. This project is confirmed to be compatible with typst-docs [v0.13.1](https://github.com/typst/typst/tree/v0.13.1). Other versions are usually compatible as well, but they have not been tested carefully.

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.

```sh
# Run in the root directory of typst/typst repository
cargo run --package typst-docs -- --assets-dir assets --out-file docs.json --base /docs/
```

```plaintext
public
├── assets ⇒ /path/to/typst/assets
└── docs.json ⇒ /path/to/typst/docs.json
```

Create `/public/metadata.json` and describe the metadata for the documentation website. For details on each property, refer to the JSON schema. For example:

```json
{
"$schema": "../metadata.schema.json",
"language": "ja-JP",
"version": "0.13.1",
"typstOfficialUrl": "https://typst.app",
"typstOfficialDocsUrl": "https://typst.app/docs/",
"githubOrganizationUrl": "https://github.com/typst-jp",
"githubRepositoryUrl": "https://github.com/typst-jp/docs",
"discordServerUrl": "https://discord.gg/9xF7k4aAuH",
"originUrl": "https://typst-jp.github.io/",
"basePath": "/docs/",
"displayTranslationStatus": true
}
```

`/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.

## Commands

After installing dependencies with Bun, the following commands are available:

```sh
bun install --frozen-lockfile
```

### Develop

> [!NOTE]
> 全文検索のインデックスは[pagefind](https://pagefind.app/)で生成していますが、インデックスの出力先が`dist/`になっているため、現在は開発サーバーで全文検索が機能しません。検索機能関連の開発をする場合は、`bun run build`を実行してから、`bun run preview`でビルド後の状態を確認してください。
> The full-text search index is generated by [pagefind](https://pagefind.app/), but since the output directory is set to `/dist/`, full-text search functionality is currently unavailable in the development server. For developing search-related features, please execute `bun run build` first, then use `bun run preview` to inspect the built output.

```sh
bun run dev
Expand All @@ -29,10 +91,10 @@ bun run preview
### Check

```sh
# コードスタイルをチェックする
# Check code style
bun run check

# 自動修正を行う
# Apply automatic code fixes
bun run check:write
```

Expand All @@ -41,3 +103,13 @@ bun run check:write
```sh
bun run test
```

## Maintainers
Copy link
Contributor

@YDX-2147483647 YDX-2147483647 Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we note the version of typst-docs json somewhere? For example:

The JSON structure generated by typst-docs is not stable.
This project is confirmed to be compatible with typst-docs from v0.13.1 to the dev version on 2025-09-18.
Other versions are usually compatible as well, but they have not been tested carefully.

The typst-docs says the JSON structure is not stable and may change at any time, and it is likely to change soon (because of typst/typst#6922).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good idea to clearly state the supported version.
However, since we don't want to update the README too frequently, I believe it's better to mention only the released versions.
The best approach would be to ensure compatibility by running documentation generation tests for the supported versions in CI.


- [@3w36zj6](https://github.com/3w36zj6)

## License

This project is derived from [typst/typst](https://github.com/typst/typst) and is licensed under the Apache-2.0 license.

Non-OSS assets distributed by the Typst web app are not included in this project.
Binary file added website/typst-docs-web/images/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.