Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 4 additions & 4 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-artifacts
path: website/dist
path: website/typst-docs-web/dist
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
with:
folder: website/dist # The folder the action should deploy.
folder: website/typst-docs-web/dist # The folder the action should deploy.

textlint-md:
runs-on: ubuntu-24.04
Expand All @@ -52,7 +52,7 @@ jobs:
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: build-artifacts
path: website/dist
path: website/typst-docs-web/dist
- uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
- name: Install dependencies
run: bun install --frozen-lockfile
Expand All @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: ./website
working-directory: website/typst-docs-web
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .textlintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# hayagrivaのsrc/csl/archive.rsで管理されている参考文献フォーマット
website/dist/reference/model/bibliography/index.html
website/dist/reference/model/cite/index.html
website/typst-docs-web/dist/reference/model/bibliography/index.html
website/typst-docs-web/dist/reference/model/cite/index.html
8 changes: 4 additions & 4 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ run = "cargo run --package typst-docs -- --assets-dir assets --out-file docs.jso
[tasks.generate-web]
depends = ["install-website"]
run = ["bun run build"]
dir = "./website"
dir = "./website/typst-docs-web"

[tasks.generate]
run = [
Expand All @@ -27,17 +27,17 @@ run = [

[tasks.install-website]
run = "bun install --frozen-lockfile"
dir = "./website"
dir = "./website/typst-docs-web"

[tasks.dev]
depends = ["install-website"]
run = "bun run dev"
dir = "./website"
dir = "./website/typst-docs-web"

[tasks.preview]
depends = ["install-website"]
run = "bun run preview"
dir = "./website"
dir = "./website/typst-docs-web"

[tasks.install-textlint]
run = "bun install --frozen-lockfile"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"textlint-md": "textlint ./docs/",
"textlint-md:fix": "textlint --fix ./docs/",
"textlint-html": "textlint ./website/dist/"
"textlint-html": "textlint ./website/typst-docs-web/dist/"
},
"devDependencies": {
"@types/bun": "latest",
Expand Down
6 changes: 4 additions & 2 deletions website/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "./metadata.schema.json",
"$schema": "./typst-docs-web/metadata.schema.json",
"language": "ja-JP",
"version": "0.13.1",
"typstOfficialUrl": "https://typst.app",
Expand All @@ -9,5 +9,7 @@
"discordServerUrl": "https://discord.gg/9xF7k4aAuH",
"originUrl": "https://typst-jp.github.io/",
"basePath": "/docs/",
"displayTranslationStatus": true
"displayTranslationStatus": true,
"docsJsonPath": "../../docs.json",
"assetsPath": "../../assets/"
}
2 changes: 1 addition & 1 deletion website/translation-status.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "./translation-status.schema.json",
"$schema": "./typst-docs-web/translation-status.schema.json",
"/docs/": "translated",
"/docs/tutorial/": "translated",
"/docs/tutorial/writing-in-typst/": "translated",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
"displayTranslationStatus": {
"type": "boolean",
"description": "Indicates whether to display the translation status on the site. Community content is always displayed."
},
"docsJsonPath": {
"type": "string",
"description": "The relative path to docs.json from the SSG project root."
},
"assetsPath": {
"type": "string",
"description": "The relative path to the assets directory from the SSG project root."
}
},
"required": [
Expand All @@ -61,6 +69,8 @@
"discordServerUrl",
"originUrl",
"basePath",
"displayTranslationStatus"
"displayTranslationStatus",
"docsJsonPath",
"assetsPath"
]
}
File renamed without changes.
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { serveStatic } from "@hono/node-server/serve-static";
import { Hono } from "hono";
import { appendTrailingSlash, trimTrailingSlash } from "hono/trailing-slash";
// Documentation generated by typst-docs.
import docsJson from "../../docs.json";
import docsJson from "../public/docs.json";
import {
CategoryTemplate,
FuncTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import metadataJson from "../metadata.json";
import metadataJson from "../../metadata.json";

type Metadata = {
language: "ja-JP" | "en-US";
Expand All @@ -11,6 +11,8 @@ type Metadata = {
originUrl: string;
basePath: "/" | `/${string}/`;
displayTranslationStatus: boolean;
docsJsonPath: string;
assetsPath: string;
};

const metadata = metadataJson as Metadata;
Expand All @@ -35,3 +37,7 @@ export const originUrl = metadata.originUrl;
export const basePath = metadata.basePath;
/** Indicates whether to display the translation status on the site. Community content is always displayed. */
export const displayTranslationStatus = metadata.displayTranslationStatus;
/** The relative path to docs.json from the SSG project root. */
export const docsJsonPath = metadata.docsJsonPath;
/** The relative path to the assets directory from the SSG project root. */
export const assetsPath = metadata.assetsPath;
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type TranslationStatusMap = {
};

const TRANSLATION_STATUS_FILE = path.resolve(
process.cwd(),
path.dirname(process.cwd()),
"translation-status.json",
);

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import devServer, { defaultOptions } from "@hono/vite-dev-server";
import ssg from "@hono/vite-ssg";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import { basePath, originUrl } from "./src/metadata";
import { assetsPath, basePath, docsJsonPath, originUrl } from "./src/metadata";
import { joinPath } from "./src/utils/path";

// Create a symbolic link to the assets generated by typst-docs in ./public/assets/
const assetsDocsPath = resolve(__dirname, "../assets/");
const assetsDocsPath = resolve(__dirname, assetsPath);
const publicAssetsDocsPath = resolve(__dirname, "./public/assets/");
rmSync(publicAssetsDocsPath, { recursive: true, force: true });
symlinkSync(assetsDocsPath, publicAssetsDocsPath, "dir");
Copy link
Contributor

@YDX-2147483647 YDX-2147483647 Sep 8, 2025

Choose a reason for hiding this comment

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

How about [Option C] letting typst-docs-web always read typst-docs-web/public/, and creating symlinks in mise.toml?

[Option C'] Also creating a symlink from metadata.json to typst-docs-web/public/metadata.json.


// Create a symbolic link to the assets generated by typst-docs in ./public/docs.json
const jsonDocsPath = resolve(__dirname, "../docs.json");
const jsonDocsPath = resolve(__dirname, docsJsonPath);
const publicJsonDocsPath = resolve(__dirname, "./public/docs.json");
rmSync(publicJsonDocsPath, { recursive: true, force: true });
symlinkSync(jsonDocsPath, publicJsonDocsPath, "file");
Expand Down