From 66e6fd8f94dee13c86a2e4e6e92a2a87a09bd2fb Mon Sep 17 00:00:00 2001 From: 4matic Date: Wed, 11 Nov 2026 14:19:47 +0200 Subject: [PATCH 1/6] docs(site): Rust on every page, links between guides, reference, spec and playground, and one language choice site-wide --- AGENTS.md | 3 +- site/src/components/Compare.astro | 3 +- site/src/components/Features.astro | 1 + site/src/components/HeroDemo.astro | 28 +- site/src/components/Install.astro | 94 ++++-- site/src/components/Playground.astro | 179 ++++++++++-- site/src/components/SocialIcons.astro | 18 +- site/src/components/Stats.astro | 2 +- site/src/content/docs/guides/artists.mdx | 82 +++++- .../docs/guides/editing-tracklists.mdx | 127 ++++++-- site/src/content/docs/guides/formatting.mdx | 42 ++- .../content/docs/guides/junk-and-flags.mdx | 44 ++- site/src/content/docs/guides/modes.mdx | 35 ++- site/src/content/docs/guides/tracklists.mdx | 160 ++++++++-- site/src/content/docs/guides/versions.mdx | 47 ++- .../docs/guides/what-it-understands.md | 32 +- site/src/content/docs/index.mdx | 20 +- site/src/content/docs/playground.mdx | 9 +- site/src/content/docs/project/comparison.md | 9 +- site/src/content/docs/project/contributing.md | 79 ++++- site/src/content/docs/project/how-it-works.md | 47 ++- site/src/content/docs/project/ports.md | 45 ++- site/src/content/docs/project/roadmap.md | 25 +- site/src/content/docs/project/testing.md | 67 ++++- site/src/content/docs/reference/functions.mdx | 100 +++++-- site/src/content/docs/reference/options.mdx | 124 ++++++-- site/src/content/docs/reference/parse.mdx | 211 ++++++++++++-- site/src/content/docs/reference/tracklist.mdx | 89 ++++-- site/src/content/docs/reference/warnings.md | 55 ---- site/src/content/docs/reference/warnings.mdx | 273 ++++++++++++++++++ .../content/docs/start/getting-started.mdx | 99 ++++++- site/src/content/docs/start/introduction.mdx | 73 +++-- site/src/lib/lang.ts | 59 ++++ site/src/lib/trackview.ts | 19 +- site/src/styles/custom.css | 11 + 35 files changed, 1909 insertions(+), 402 deletions(-) delete mode 100644 site/src/content/docs/reference/warnings.md create mode 100644 site/src/content/docs/reference/warnings.mdx create mode 100644 site/src/lib/lang.ts diff --git a/AGENTS.md b/AGENTS.md index 6041275..8a7927f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,7 +110,8 @@ site/ documentation site + playground (Astro + Starlight, Gi src/content/docs/ the pages (Markdown/MDX, JS + Python + Rust tabs on every example); reference/spec.md is generated from spec/SPEC.md src/components/ HeroDemo, Playground (runs js/ in the browser), Feature, Stats - src/lib/ trackview.ts (highlight + field rendering), icons.ts (Lucide SVG strings) + src/lib/ trackview.ts (highlight + field rendering), icons.ts (Lucide SVG strings), + lang.ts (one language choice for docs tabs, install switch, playground) scripts/sync-spec.mjs copies spec/SPEC.md into the docs at build time scripts/compare-ports.mjs every fixture through js/dist, the Python port and the Rust crate, diffs the full outputs (parseTracklist and applyEdits included); diff --git a/site/src/components/Compare.astro b/site/src/components/Compare.astro index 2cd8287..eed60a0 100644 --- a/site/src/components/Compare.astro +++ b/site/src/components/Compare.astro @@ -106,7 +106,8 @@ const rows: [string, string, string][] = [ @media (max-width: 34rem) { thead th:first-child, tbody th { - width: 4.8rem; + width: 5.4rem; + overflow-wrap: normal; } th, td { diff --git a/site/src/components/Features.astro b/site/src/components/Features.astro index 36e2ff8..4c661ce 100644 --- a/site/src/components/Features.astro +++ b/site/src/components/Features.astro @@ -32,6 +32,7 @@ const { items } = Astro.props as { items: Item[] }; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); column-gap: 0.4rem; + align-content: start; padding: 1.25rem 0 1.35rem; border-top: 1px solid var(--tp-border); margin: 0; diff --git a/site/src/components/HeroDemo.astro b/site/src/components/HeroDemo.astro index e05a87a..365805f 100644 --- a/site/src/components/HeroDemo.astro +++ b/site/src/components/HeroDemo.astro @@ -11,12 +11,13 @@ const examples = [ "Кино - Группа крови (Remastered 2019)", "ID - ID (ID Remix)", ]; -const playground = `${import.meta.env.BASE_URL}playground/`; +const base = import.meta.env.BASE_URL.replace(/\/$/, ""); +const playground = `${base}/playground/`; --- -
+
- parse(input)runs the real package in your browser + parse(input)the npm package, running in your browser
@@ -47,6 +48,7 @@ const playground = `${import.meta.env.BASE_URL}playground/`;
@@ -120,9 +122,23 @@ const playground = `${import.meta.env.BASE_URL}playground/`; padding: 0.4rem 1.1rem 1.1rem; } .hd-foot { - justify-content: flex-end; + flex-wrap: wrap; border-top: 1px solid var(--tp-border); } + .hd-note { + color: var(--sl-color-gray-3); + } + .hd-note a { + color: var(--sl-color-gray-2); + text-decoration: underline; + text-decoration-color: var(--tp-border-strong); + text-underline-offset: 0.2em; + white-space: nowrap; + } + .hd-note a:hover { + color: var(--sl-color-white); + text-decoration-color: var(--sl-color-accent); + } .hd-open { display: inline-flex; align-items: center; @@ -130,6 +146,8 @@ const playground = `${import.meta.env.BASE_URL}playground/`; font-weight: 500; color: var(--sl-color-white); text-decoration: none; + margin-left: auto; + white-space: nowrap; } .hd-open:hover { color: var(--sl-color-accent-high); @@ -163,7 +181,7 @@ const playground = `${import.meta.env.BASE_URL}playground/`; line.innerHTML = segmentsHtml(segs) || 'type a track name'; const kinds = [...new Set(segs.map((x) => x.kind).filter(Boolean))] as Kind[]; legend.innerHTML = kinds.map((k) => chip(KIND_LABEL[k], k)).join(""); - fields.innerHTML = fieldsHtml(track); + fields.innerHTML = fieldsHtml(track, root.dataset.base); open.href = `${base}#track=${encodeURIComponent(s)}`; time.textContent = `${ms < 1 ? "<1" : ms.toFixed(1)} ms`; for (const b of buttons) b.setAttribute("aria-pressed", String(b.dataset.example === s)); diff --git a/site/src/components/Install.astro b/site/src/components/Install.astro index 58dd715..20540ba 100644 --- a/site/src/components/Install.astro +++ b/site/src/components/Install.astro @@ -1,26 +1,45 @@ --- // One install line under the hero, switchable between npm, pip and cargo, with a copy button. +// The switch shares its choice with the docs' language tabs and the playground (lib/lang.ts). +import Check from "@lucide/astro/icons/check"; import Copy from "@lucide/astro/icons/copy"; +import { PACKAGE } from "../lib/lang"; -const cmds = { npm: "npm install trackparse", pip: "pip install trackparse", cargo: "cargo add trackparse" }; +const pms = [ + { lang: "js", label: "npm" }, + { lang: "py", label: "pip" }, + { lang: "rs", label: "cargo" }, +] as const; --- -
-
- - - +
+
+
+ { + pms.map((p, i) => ( + + )) + } +
+ {PACKAGE.js.install} +
- {cmds.npm} - +

+ Published on npm, PyPI and{" "} + crates.io. The Rust API docs are on docs.rs. +

diff --git a/site/src/components/Playground.astro b/site/src/components/Playground.astro index efae167..4ad857a 100644 --- a/site/src/components/Playground.astro +++ b/site/src/components/Playground.astro @@ -6,6 +6,10 @@ import Redo2 from "@lucide/astro/icons/redo-2"; import Undo2 from "@lucide/astro/icons/undo-2"; import "../styles/playground.css"; +// Docs links next to the controls they explain. +const base = import.meta.env.BASE_URL.replace(/\/$/, ""); +const doc = (path: string) => `${base}/${path}`; + const trackExamples = [ "01. Wilkinson ft. Becky Hill & Tom Cane - Afterglow (Sub Focus VIP Remix) [Official Video]", "Dimension - Offshore (Mefjus Remix / Noisia Remix)", @@ -71,7 +75,7 @@ const listExamples: { label: string; title: string; text: string }[] = [ ]; --- -
+
@@ -142,7 +153,10 @@ const listExamples: { label: string; title: string; text: string }[] = [

       
- format(track, options) +
+ format(track, options) + Formatting guide +
@@ -178,13 +192,23 @@ const listExamples: { label: string; title: string; text: string }[] = [

-        
+        
+ +

+