diff --git a/README.md b/README.md
index 6f80fa66..2f076652 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist
Tinymist \[ˈtaɪni mɪst\] is an integrated language service for [Typst](https://typst.app/) \[taɪpst\]. You can also call it "微霭" \[wēi ǎi\] in Chinese.
@@ -125,11 +125,11 @@ See [Online Documentation](https://myriad-dreamin.github.io/tinymist/).
Stable Channel:
-[Packaging status](https://repology.org/project/tinymist/versions)
+
Nightly Channel:
-[Packaging status](https://repology.org/project/tinymist-nightly/versions)
+
## Roadmap
diff --git a/crates/typlite/README.md b/crates/typlite/README.md
index 5a9d5f35..2b897fb7 100644
--- a/crates/typlite/README.md
+++ b/crates/typlite/README.md
@@ -1,4 +1,4 @@
-
+
# Typlite
Converts a subset of typst to markdown.
diff --git a/crates/typlite/src/lib.rs b/crates/typlite/src/lib.rs
index fe964eb2..a45babc4 100644
--- a/crates/typlite/src/lib.rs
+++ b/crates/typlite/src/lib.rs
@@ -3,7 +3,6 @@
pub mod attributes;
pub mod common;
mod error;
-pub mod library;
pub mod parser;
pub mod tags;
pub mod writer;
diff --git a/crates/typlite/src/library.rs b/crates/typlite/src/library.rs
deleted file mode 100644
index 783c15c1..00000000
--- a/crates/typlite/src/library.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//! # Typlite Library
-
-// scopes.define("link", link as RawFunc);
-// scopes.define("kbd", kbd as RawFunc);
-// scopes.define("md-alter", md_alter as RawFunc);
-// scopes.define("image", image as RawFunc);
-// scopes.define("figure", figure as RawFunc);
-// scopes.define("raw", raw as RawFunc);
-// scopes.define("strike", strike as RawFunc);
-// scopes.define("pad", pad as RawFunc);
-// scopes.define("note-box", note as RawFunc);
-// scopes.define("tip-box", tip as RawFunc);
-// scopes.define("important-box", important_box as RawFunc);
-// scopes.define("warning-box", warning_box as RawFunc);
-// scopes.define("caution-box", caution_box as RawFunc);
-// scopes.define("table", table as RawFunc);
-// scopes.define("grid", grid as RawFunc);
-// pub fn cross_link(mut args: Args) -> typlite::Result
diff --git a/docs/release-instruction.md b/docs/release-instruction.md
index 4f237c6f..28b7ce0e 100644
--- a/docs/release-instruction.md
+++ b/docs/release-instruction.md
@@ -1,4 +1,4 @@
-
+
# Release Instructions
Normally, you should always create release candidates to avoid failures in the release process. For example, if you are releasing version `0.12.19`, you should create a release candidate `0.12.19-rc1` first. This is because once you tag a version, you cannot delete it, otherwise the people in downstream that already pull the tag will have to force update their repository. The release candidates are canaries to test any potential poison in the release process. Two things to note:
diff --git a/docs/tinymist/crates/typlite.typ b/docs/tinymist/crates/typlite.typ
index 1a142cb5..79814ddd 100644
--- a/docs/tinymist/crates/typlite.typ
+++ b/docs/tinymist/crates/typlite.typ
@@ -1,3 +1,8 @@
+
+#import "/docs/tinymist/frontend/mod.typ": *
+
+#show: book-page.with(title: [Typlite])
+
#show raw.where(lang: "sh"): it => [#it#metadata(it.text)]
Converts a subset of typst to markdown.
diff --git a/docs/tinymist/frontend/emacs.typ b/docs/tinymist/frontend/emacs.typ
index ddb92a3e..9056a996 100644
--- a/docs/tinymist/frontend/emacs.typ
+++ b/docs/tinymist/frontend/emacs.typ
@@ -1,6 +1,6 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [Emacs])
+#show: book-page.with(title: [Tinymist Emacs Support for Typst])
Run and configure tinymist in Emacs for Typst.
diff --git a/docs/tinymist/frontend/helix.typ b/docs/tinymist/frontend/helix.typ
index 4e2a8be3..464ad4c8 100644
--- a/docs/tinymist/frontend/helix.typ
+++ b/docs/tinymist/frontend/helix.typ
@@ -1,6 +1,6 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [Helix])
+#show: book-page.with(title: [Tinymist Helix Support for Typst])
Run and configure tinymist in helix for Typst.
diff --git a/docs/tinymist/frontend/neovim.typ b/docs/tinymist/frontend/neovim.typ
index bc13ed82..e5e5d3fc 100644
--- a/docs/tinymist/frontend/neovim.typ
+++ b/docs/tinymist/frontend/neovim.typ
@@ -1,6 +1,6 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [Neovim])
+#show: book-page.with(title: [Tinymist Neovim Support for Typst])
Run and configure `tinymist` in Neovim with support for all major distros and package managers.
diff --git a/docs/tinymist/frontend/sublime-text.typ b/docs/tinymist/frontend/sublime-text.typ
index 26714f32..7cc76bd9 100644
--- a/docs/tinymist/frontend/sublime-text.typ
+++ b/docs/tinymist/frontend/sublime-text.typ
@@ -1,7 +1,7 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [Sublime Support])
+#show: book-page.with(title: [Tinymist Sublime Support for Typst])
Follow the instructions in the #link("https://github.com/sublimelsp/LSP/blob/main/docs/src/language_servers.md#tinymist")[sublimelsp documentation] to make it work.
diff --git a/docs/tinymist/frontend/vscode.typ b/docs/tinymist/frontend/vscode.typ
index b3c315b7..361bf65e 100644
--- a/docs/tinymist/frontend/vscode.typ
+++ b/docs/tinymist/frontend/vscode.typ
@@ -1,6 +1,6 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [VS Cod(e,ium)])
+#show: book-page.with(title: [Tinymist Typst VS Code Extension])
A VS Code or VS Codium extension for Typst. You can find the extension on:
diff --git a/docs/tinymist/frontend/zed.typ b/docs/tinymist/frontend/zed.typ
index c21990a1..04529371 100644
--- a/docs/tinymist/frontend/zed.typ
+++ b/docs/tinymist/frontend/zed.typ
@@ -1,6 +1,6 @@
#import "/docs/tinymist/frontend/mod.typ": *
-#show: book-page.with(title: [Zed])
+#show: book-page.with(title: [Tinymist Zed Support for Typst])
See #link("https://github.com/WeetHet/typst.zed")[typst.zed];.
diff --git a/docs/tinymist/introduction.typ b/docs/tinymist/introduction.typ
index 6b25c2b2..36d483a5 100644
--- a/docs/tinymist/introduction.typ
+++ b/docs/tinymist/introduction.typ
@@ -2,7 +2,13 @@
// dist/tinymist/rs
#import "mod.typ": *
-#show: book-page.with(title: "Introduction")
+#let title = if is-md-target {
+ "Tinymist"
+} else {
+ "Introduction"
+}
+
+#show: book-page.with(title: title)
Tinymist [ˈtaɪni mɪst] is an integrated language service for #link("https://typst.app/")[Typst] [taɪpst]. You can also call it "微霭" [wēi ǎi] in Chinese.
@@ -62,24 +68,30 @@ See #link("https://myriad-dreamin.github.io/tinymist/")[Online Documentation].
= Packaging
+#let channel-img(lnk, img) = if sys-is-html-target {
+ html.elem("a", attrs: (
+ href: lnk,
+ target: "_blank",
+ rel: "noopener noreferrer",
+ ))[
+ #html.elem("img", attrs: (src: img, alt: "Packaging status", style: "max-width: 100%; height: auto;"))
+ ]
+} else {
+ link(lnk)
+}
+
Stable Channel:
-#link(
+#channel-img(
"https://repology.org/project/tinymist/versions",
- md-alter(
- "Packaging status",
- () => image("https://repology.org/badge/vertical-allrepos/tinymist.svg", alt: "Packaging status"),
- ),
+ "https://repology.org/badge/vertical-allrepos/tinymist.svg",
)
Nightly Channel:
-#link(
+#channel-img(
"https://repology.org/project/tinymist-nightly/versions",
- md-alter(
- "Packaging status",
- () => image("https://repology.org/badge/vertical-allrepos/tinymist-nightly.svg", alt: "Packaging status"),
- ),
+ "https://repology.org/badge/vertical-allrepos/tinymist-nightly.svg",
)
= Roadmap
diff --git a/docs/tinymist/mod.typ b/docs/tinymist/mod.typ
index acae33d8..654fc226 100644
--- a/docs/tinymist/mod.typ
+++ b/docs/tinymist/mod.typ
@@ -24,8 +24,6 @@
} else {
raw
}
-#let md-alter(left, right) = left
-
#import fletcher.shapes: diamond
#let fg-blue = main-color.mix(rgb("#0074d9"))
diff --git a/editors/emacs/README.md b/editors/emacs/README.md
index 8c7583cb..8142944c 100644
--- a/editors/emacs/README.md
+++ b/editors/emacs/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Emacs Support for Typst
Run and configure tinymist in Emacs for Typst.
diff --git a/editors/helix/README.md b/editors/helix/README.md
index ac33c032..249d594a 100644
--- a/editors/helix/README.md
+++ b/editors/helix/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Helix Support for Typst
Run and configure tinymist in helix for Typst.
diff --git a/editors/neovim/README.md b/editors/neovim/README.md
index 68d09e31..79088ecd 100644
--- a/editors/neovim/README.md
+++ b/editors/neovim/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Neovim Support for Typst
Run and configure `tinymist` in Neovim with support for all major distros and package managers.
diff --git a/editors/sublime-text/README.md b/editors/sublime-text/README.md
index b192b267..593b5d1b 100644
--- a/editors/sublime-text/README.md
+++ b/editors/sublime-text/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Sublime Support for Typst
Follow the instructions in the [sublimelsp documentation](https://github.com/sublimelsp/LSP/blob/main/docs/src/language_servers.md#tinymist) to make it work.
diff --git a/editors/vscode/README.md b/editors/vscode/README.md
index 4391a5df..6396fbfa 100644
--- a/editors/vscode/README.md
+++ b/editors/vscode/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Typst VS Code Extension
A VS Code or VS Codium extension for Typst. You can find the extension on:
diff --git a/editors/zed/README.md b/editors/zed/README.md
index 35ee5a5d..6bfbc173 100644
--- a/editors/zed/README.md
+++ b/editors/zed/README.md
@@ -1,4 +1,4 @@
-
+
# Tinymist Zed Support for Typst
See [typst.zed](https://github.com/WeetHet/typst.zed).
diff --git a/scripts/link-docs.mjs b/scripts/link-docs.mjs
index 7601bb28..28c9c98a 100644
--- a/scripts/link-docs.mjs
+++ b/scripts/link-docs.mjs
@@ -1,20 +1,12 @@
import { resolve, basename, relative } from "path";
import * as fs from "fs";
+import * as util from "util";
import { execSync } from "child_process";
+const exec = util.promisify(execSync);
const root = resolve(import.meta.dirname, "..");
const dry = process.argv.includes("--dry");
-const bytes2utf8 = new TextDecoder();
-
-/**
- * Base64 to UTF-8
- * @param encoded Base64 encoded string
- * @returns UTF-8 string
- */
-export const base64Decode = (encoded) =>
- bytes2utf8.decode(Uint8Array.from(atob(encoded), (m) => m.charCodeAt(0)));
-
const yarn = (cmd, stdio = "inherit") => {
const script = `yarn run ${cmd}`;
if (dry) {
@@ -32,19 +24,32 @@ const typlite = (input, output) => {
return res.toString();
};
-const convert = async (inp, out, opts) => {
+const isCheck = process.argv.includes("--check");
+
+const convert = async ({ input: inp, output: out }) => {
const input = resolve(root, inp);
const output = resolve(root, out);
- const { before } = opts || {};
- const res = typlite(input, output).trim();
+ const outputContent = typlite(input, output).trim();
if (dry) {
- console.log(res);
+ console.log(outputContent);
return;
}
- const outputContent = `\n${before || ""}${res}\n`;
- await fs.promises.writeFile(output, outputContent);
+ await fs.promises.writeFile(output, outputContent.trim() + "\n");
+
+ if (isCheck) {
+ const gitStatus = (
+ await exec(`git status --porcelain ${output}`, {
+ encoding: "utf-8",
+ })
+ ).trim();
+ if (gitStatus) {
+ throw new Error(
+ `The file ${out} is not up to date. Please run \`node scripts/link-docs.mjs\` locally to update it.`,
+ );
+ }
+ }
};
// todo: generate me using typlite.
@@ -113,77 +118,45 @@ const maintainerMd = async () => {
await fs.promises.writeFile(outPath, outputContent);
};
-const isCheck = process.argv.includes("--check");
-
const tasks = [
{
input: "docs/tinymist/introduction.typ",
output: "README.md",
- title: "Tinymist",
},
{
input: "docs/tinymist/release-instruction.typ",
output: "docs/release-instruction.md",
- title: "Release Instructions",
},
{
input: "docs/tinymist/crates/typlite.typ",
output: "crates/typlite/README.md",
- title: "Typlite",
},
{
input: "docs/tinymist/frontend/emacs.typ",
output: "editors/emacs/README.md",
- title: "Tinymist Emacs Support for Typst",
},
{
input: "docs/tinymist/frontend/helix.typ",
output: "editors/helix/README.md",
- title: "Tinymist Helix Support for Typst",
},
{
input: "docs/tinymist/frontend/neovim.typ",
output: "editors/neovim/README.md",
- title: "Tinymist Neovim Support for Typst",
},
{
input: "docs/tinymist/frontend/sublime-text.typ",
output: "editors/sublime-text/README.md",
- title: "Tinymist Sublime Support for Typst",
},
{
input: "docs/tinymist/frontend/vscode.typ",
output: "editors/vscode/README.md",
- title: "Tinymist Typst VS Code Extension",
},
{
input: "docs/tinymist/frontend/zed.typ",
output: "editors/zed/README.md",
- title: "Tinymist Zed Support for Typst",
},
];
-const main = async () => {
- await Promise.all([
- ...tasks.map((task) => convert(task.input, task.output, { before: `# ${task.title}\n\n` })),
- maintainerMd(),
- ]);
-
- if (isCheck) {
- // any dirty git files?
- await Promise.all(
- tasks.map(async (task) => {
- const gitStatus = execSync(`git status --porcelain ${task.output}`, {
- encoding: "utf-8",
- }).trim();
- if (gitStatus) {
- throw new Error(
- `The file ${task.output} is not up to date. Please run \`node scripts/link-docs.mjs\` to update it.`,
- );
- }
- }),
- );
- }
-};
+const main = async () => await Promise.all([...tasks.map(convert), maintainerMd()]);
main();
diff --git a/typ/templates/ebook.typ b/typ/templates/ebook.typ
index ee8b5025..8f4bd0c1 100644
--- a/typ/templates/ebook.typ
+++ b/typ/templates/ebook.typ
@@ -16,7 +16,7 @@
)
// Inherit from gh-pages
- show: _page-project
+ show: _page-project.with(title: title)
if title != "" {
set text(size: heading-sizes.at(1))
diff --git a/typ/templates/page.typ b/typ/templates/page.typ
index eef06b20..2b064e7f 100644
--- a/typ/templates/page.typ
+++ b/typ/templates/page.typ
@@ -331,7 +331,7 @@
/// The project function defines how your document looks.
/// It takes your content and some metadata and formats it.
/// Go ahead and customize it to your liking!
-#let project(title: "Tinymist Docs", authors: (), kind: "page", description: none, body) = {
+#let project(title: "", authors: (), kind: "page", description: none, body) = {
// set basic document metadata
set document(
author: authors,
@@ -443,6 +443,15 @@
if kind == "page" and is-pdf-target and not is-main {
text(size: 32pt, heading(level: 1, numbering: none, title))
}
+ if is-md-target {
+ html.elem("m1verbatim", attrs: (
+ src: "\n",
+ ))
+ let title-text = plain-text(title)
+ if title-text.len() > 0 {
+ html.elem("m1verbatim", attrs: (src: "# " + title-text + "\n"))
+ }
+ }
// Main body.
set par(justify: true)