Compare commits

...

2 Commits

Author SHA1 Message Date
1465ec23be feat: move api docs to versioned path 2024-11-23 18:48:11 -05:00
2b532080d8 feat: begin to version docs 2024-11-23 18:35:32 -05:00
22 changed files with 28 additions and 24 deletions

View File

@ -25,6 +25,8 @@
--font-code: "Iosevka Fixed Web", "Iosevka Nerd Font", Iosevka, monospace; --font-code: "Iosevka Fixed Web", "Iosevka Nerd Font", Iosevka, monospace;
} }
[x-cloak] { display: none !important; }
:root { :root {
--c-bg: #121212; --c-bg: #121212;
--c-text: rgb(200, 200, 200); --c-text: rgb(200, 200, 200);

View File

@ -24,13 +24,13 @@ const { showSidebarButton = true, version = "latest" } = Astro.props;
Learn Learn
</a> </a>
<a <a
href="/api/std/" href={`/en/${version}/api/std/`}
class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline" class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline"
> >
Standard Library Standard Library
</a> </a>
<a <a
href="/spec/" href={`/en/${version}/spec/`}
class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline" class="hidden sm:inline-block px-4 font-display font-bold-text-xl hover:underline"
> >
Language spec Language spec

View File

@ -18,7 +18,9 @@ export type Post = {
type Posts = Array<Readonly<Post>>; type Posts = Array<Readonly<Post>>;
const basePath = "/api/std"; const basePath = "/api/std";
const posts: Posts = await Astro.glob("../pages/api/std/**/*.{md,mdx}"); const posts: Posts = await Astro.glob(
"../pages/en/latest/api/std/**/*.{md,mdx}",
);
export type Hierarchy = { export type Hierarchy = {
posts: Array<Post>; posts: Array<Post>;

View File

@ -129,9 +129,6 @@ const rc = url_components[1] ?? "";
> >
<nav class="py-4 pr-2 overflow-x-scroll h-[calc(100vh-3rem)]"> <nav class="py-4 pr-2 overflow-x-scroll h-[calc(100vh-3rem)]">
<div class="mb-2 relative" x-data="{open: false}"> <div class="mb-2 relative" x-data="{open: false}">
<div>
<span> Language version: </span>
</div>
<button <button
class="bg-c-bg text-c-text border border-c-primary rounded px-3 w-full font-mono mt-2 flex items-center hover:dark:bg-zinc-800 transition-colors cursor-pointer text-left" class="bg-c-bg text-c-text border border-c-primary rounded px-3 w-full font-mono mt-2 flex items-center hover:dark:bg-zinc-800 transition-colors cursor-pointer text-left"
@click="open = !open" @click="open = !open"
@ -152,6 +149,7 @@ const rc = url_components[1] ?? "";
</svg> </svg>
</button> </button>
<div <div
x-cloak
x-bind:class="open? '': 'hidden'" x-bind:class="open? '': 'hidden'"
class="bottom-0 w-full absolute" class="bottom-0 w-full absolute"
> >

View File

@ -1,11 +1,11 @@
--- ---
layout: ../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import TwoColumn from "../../../components/TwoColumn.astro"; import TwoColumn from "@/components/TwoColumn.astro";
import Code from "../../../components/Code.astro"; import Code from "@/components/Code.astro";
import CodeMin from "../../../components/docs/CodeMin.astro"; import CodeMin from "@/components/docs/CodeMin.astro";
import Warning from "../../../components/docs/Warning.astro"; import Warning from "@/components/docs/Warning.astro";
# Array # Array

View File

@ -1,8 +1,8 @@
--- ---
layout: ../../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import Code from "../../../../components/Code.astro"; import Code from "@/components/Code.astro";
# `Array.concat` # `Array.concat`

View File

@ -1,8 +1,8 @@
--- ---
layout: ../../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import Code from "../../../../components/Code.astro"; import Code from "@/components/Code.astro";
# `Array.fold` # `Array.fold`

View File

@ -1,8 +1,8 @@
--- ---
layout: ../../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import Code from "../../../../components/Code.astro"; import Code from "@/components/Code.astro";
# `Array.map` # `Array.map`

View File

@ -1,9 +1,9 @@
--- ---
layout: ../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import TwoColumn from "../../../components/TwoColumn.astro"; import TwoColumn from "@/components/TwoColumn.astro";
import Code from "../../../components/Code.astro"; import Code from "@/components/Code.astro";
# module `std` # module `std`

View File

@ -1,9 +1,9 @@
--- ---
layout: ../../../layouts/ApiLayout.astro layout: "@/layouts/ApiLayout.astro"
--- ---
import TwoColumn from "../../../components/TwoColumn.astro"; import TwoColumn from "@/components/TwoColumn.astro";
import Code from "../../../components/Code.astro"; import Code from "@/components/Code.astro";
# `print` # `print`

View File

@ -9,7 +9,8 @@ const posts = (await Astro.glob(
)) as unknown as Array<AstroFile>; )) as unknown as Array<AstroFile>;
// The base of every URL under this glob // The base of every URL under this glob
const base_url = "/spec"; const version = "latest";
const base_url = `/en/${version}/spec`;
--- ---
<NewDocsLayout <NewDocsLayout
@ -17,6 +18,7 @@ const base_url = "/spec";
frontmatter={frontmatter} frontmatter={frontmatter}
headings={headings} headings={headings}
posts={posts} posts={posts}
version={version}
> >
<slot /> <slot />
</NewDocsLayout> </NewDocsLayout>