From 9491ec38e663f6a137d777e0fe51467af503b0d9 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Wed, 22 Nov 2023 02:28:53 +0800 Subject: [PATCH] docs: use cross links --- github-pages/docs/book.typ | 1 + github-pages/docs/cli/init.typ | 6 +++--- github-pages/docs/cli/main.typ | 16 ++++++++-------- github-pages/docs/cli/serve.typ | 4 ++-- github-pages/docs/format/book.typ | 6 +++--- github-pages/docs/format/theme.typ | 6 ++++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/github-pages/docs/book.typ b/github-pages/docs/book.typ index 4ac5dbc..7d48652 100644 --- a/github-pages/docs/book.typ +++ b/github-pages/docs/book.typ @@ -51,3 +51,4 @@ // re-export page template #import "/contrib/typst/gh-pages.typ": project #let book-page = project +#let cross-link = cross-link diff --git a/github-pages/docs/cli/init.typ b/github-pages/docs/cli/init.typ index 77a026c..ba204ad 100644 --- a/github-pages/docs/cli/init.typ +++ b/github-pages/docs/cli/init.typ @@ -1,10 +1,10 @@ -#import "/github-pages/docs/book.typ": book-page +#import "/github-pages/docs/book.typ": book-page, cross-link #show: book-page.with(title: "CLI Init Command") = The init command -The `init` command will try to initialize your book to build your book successfully by default. It is hence including all of the #link("https://myriad-dreamin.github.io/typst-book/cli/build.html")[options] from `build` command. +The `init` command will try to initialize your book to build your book successfully by default. It is hence including all of the #cross-link("/cli/build.typ")[options] from `build` command. For instance, Initialize a book to the directory `my-book`: @@ -29,7 +29,7 @@ typst-book build my-book/ # memoryized dest-dir == Things to note -The harder way, by creating the book without `init` command, your `book.typ` should at least provides a `book-meta`, as #link("https://myriad-dreamin.github.io/typst-book/guide/get-started.html")[Get Started] shown. +The harder way, by creating the book without `init` command, your `book.typ` should at least provides a `book-meta`, as #cross-link("/guide/get-started.typ")[Get Started] shown. ```typ #import "@preview/book:0.2.2": * diff --git a/github-pages/docs/cli/main.typ b/github-pages/docs/cli/main.typ index d9ba0a1..53244df 100644 --- a/github-pages/docs/cli/main.typ +++ b/github-pages/docs/cli/main.typ @@ -1,4 +1,4 @@ -#import "/github-pages/docs/book.typ": book-page +#import "/github-pages/docs/book.typ": book-page, cross-link #show: book-page.with(title: "Command Line Tool") @@ -6,17 +6,17 @@ // todo: cross link The `typst-book` command-line tool is used to create and build books. -After you have #link("https://myriad-dreamin.github.io/typst-book/guide/installation.html")[installed] `typst-book`, you can run the `typst-book help` command in your terminal to view the available commands. +After you have #cross-link("/guide/installation.typ")[installed] `typst-book`, you can run the `typst-book help` command in your terminal to view the available commands. This following sections provide in-depth information on the different commands available. // todo: cross link -- #link("https://myriad-dreamin.github.io/typst-book/cli/init.html")[`typst-book init `] — Creates a new book with minimal boilerplate to start with. -- #link("https://myriad-dreamin.github.io/typst-book/cli/build.html")[`typst-book build`] — Renders the book. -- #link("https://myriad-dreamin.github.io/typst-book/cli/serve.html")[`typst-book serve`] — Runs a web server to view the book, and rebuilds on changes. -- #link("https://myriad-dreamin.github.io/typst-book/cli/clean.html")[`typst-book clean`] — Deletes the rendered output. -- #link("https://myriad-dreamin.github.io/typst-book/cli/completions.html")[`typst-book completions`] — Support for shell auto-completion. +- #cross-link("/cli/init.typ")[`typst-book init `] — Creates a new book with minimal boilerplate to start with. +- #cross-link("/cli/build.typ")[`typst-book build`] — Renders the book. +- #cross-link("/cli/serve.typ")[`typst-book serve`] — Runs a web server to view the book, and rebuilds on changes. +- #cross-link("/cli/clean.typ")[`typst-book clean`] — Deletes the rendered output. +- #cross-link("/cli/completions.typ")[`typst-book completions`] — Support for shell auto-completion. = Note about the missing `watch` command -We suggest you to use #link("https://github.com/Enter-tainer/typst-preview")[Typst Preview plugin] for preview feature. For more details, please see #link("https://myriad-dreamin.github.io/typst-book/guide/get-started.html")[Get Started] chapter. +We suggest you to use #link("https://github.com/Enter-tainer/typst-preview")[Typst Preview plugin] for preview feature. For more details, please see #cross-link("/guide/get-started.typ")[Get Started] chapter. diff --git a/github-pages/docs/cli/serve.typ b/github-pages/docs/cli/serve.typ index e91a323..8762132 100644 --- a/github-pages/docs/cli/serve.typ +++ b/github-pages/docs/cli/serve.typ @@ -1,4 +1,4 @@ -#import "/github-pages/docs/book.typ": book-page +#import "/github-pages/docs/book.typ": book-page, cross-link #show: book-page.with(title: "CLI Serve Command") @@ -30,7 +30,7 @@ typst-book serve path/to/book == Build options -The `serve` command will build your book once before serving the content. It is hence including all of the #link("https://myriad-dreamin.github.io/typst-book/cli/build.html")[options] from `build` command. +The `serve` command will build your book once before serving the content. It is hence including all of the #cross-link("/cli/build.typ")[options] from `build` command. == Server options diff --git a/github-pages/docs/format/book.typ b/github-pages/docs/format/book.typ index 12e4790..31eb18a 100644 --- a/github-pages/docs/format/book.typ +++ b/github-pages/docs/format/book.typ @@ -1,4 +1,4 @@ -#import "/github-pages/docs/book.typ": book-page +#import "/github-pages/docs/book.typ": book-page, cross-link #show: book-page.with(title: "book.typ") @@ -41,7 +41,7 @@ In this example, you specify following fields for the book project: - authors #type-hint("array") (optional): Specify the author(s) of the book. - summary #type-hint("content") (required): Summarize of the book. -See #link("https://myriad-dreamin.github.io/typst-book/format/book-meta.html")[Book Metadata] for more details. +See #cross-link("/format/book-meta.typ")[Book Metadata] for more details. == build-meta @@ -55,4 +55,4 @@ Specify build metadata of the book project. For example: When you set `build-meta.dest-dir` to `../dist`, `typst-book` will output the generated content to `parent/to/book.typ/../../dist` or `parent/dist`. -See #link("https://myriad-dreamin.github.io/typst-book/format/build-meta.html")[Build Metadata] for more details. +See #cross-link("/format/build-meta.typ")[Build Metadata] for more details. diff --git a/github-pages/docs/format/theme.typ b/github-pages/docs/format/theme.typ index f0d7035..7cce9e7 100644 --- a/github-pages/docs/format/theme.typ +++ b/github-pages/docs/format/theme.typ @@ -1,4 +1,4 @@ -#import "/github-pages/docs/book.typ": book-page +#import "/github-pages/docs/book.typ": book-page, cross-link, cross-link-path-label #show: book-page.with(title: "Theme") @@ -12,7 +12,9 @@ Currently we have no much design on theme's html part. But you can still configu == Things to note -Your `book.typ` should at least provides a `book-meta`, as #link("https://myriad-dreamin.github.io/typst-book/guide/get-started.html")[Get Started] shown. +#let t = cross-link("/guide/get-started.typ")[Get Started] + +Your `book.typ` should at least provides a `book-meta`, as #t shown. ```typ #import "@preview/book:0.2.2": *