diff --git a/docs/build-manual.py b/docs/build-manual.py index 961eb7b..7f0468e 100644 --- a/docs/build-manual.py +++ b/docs/build-manual.py @@ -288,7 +288,11 @@ def _prettify_block(block: list[str], entry_name: str | None) -> str: # keep the whole thing in one fence rather than orphaning the rest. while lines and lines[0].startswith(" "): synopsis.append(lines.pop(0).strip()) - out.append("```fish\n" + "\n".join(synopsis) + "\n```") + # Titling the fence with the source file name (Starlight's + # filename-title convention) makes the synopsis read as a snippet + # of the function it documents rather than a bare command example. + info = f'fish title="{entry_name}.fish"' if entry_name else "fish" + out.append(f"```{info}\n" + "\n".join(synopsis) + "\n```") para: list[str] = [] for line in lines + [""]: diff --git a/docs/site/README.md b/docs/site/README.md index 1b7f5c3..93321ec 100644 --- a/docs/site/README.md +++ b/docs/site/README.md @@ -1,49 +1,34 @@ -# Starlight Starter Kit: Basics +# fish-config docs site -[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) +[Starlight](https://starlight.astro.build) site for the +[fish-config](https://git.rootiest.dev/rootiest/fish-config) manual. -``` -npm create astro@latest -- --template starlight +## Generated, not authored + +Everything under `src/content/docs/` is generated β€” **do not edit it +directly**, changes will be overwritten. The sources are: + +- `docs/manual/**` β€” prose for every section except the functions reference +- `functions/*.fish` comment headers β€” the functions reference (Section 5) + +Regenerate from the repo root: + +```fish title="regenerate the site content" +python3 docs/build-manual.py --site ``` -> πŸ§‘β€πŸš€ **Seasoned astronaut?** Delete this file. Have fun! +`docs/verify-manual.py` validates both sources before you build; run it +first if you've touched a header or a manual page. -## πŸš€ Project Structure +## Development -Inside of your Astro + Starlight project, you'll see the following folders and files: - -``` -. -β”œβ”€β”€ public/ -β”œβ”€β”€ src/ -β”‚ β”œβ”€β”€ assets/ -β”‚ β”œβ”€β”€ content/ -β”‚ β”‚ └── docs/ -β”‚ └── content.config.ts -β”œβ”€β”€ astro.config.mjs -β”œβ”€β”€ package.json -└── tsconfig.json +```fish title="local dev server" +cd docs/site +npm install +npm run dev ``` -Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. +## Deploy -Images can be added to `src/assets/` and embedded in Markdown with a relative link. - -Static assets, like favicons, can be placed in the `public/` directory. - -## 🧞 Commands - -All commands are run from the root of the project, from a terminal: - -| Command | Action | -| :------------------------ | :----------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:4321` | -| `npm run build` | Build your production site to `./dist/` | -| `npm run preview` | Preview your build locally, before deploying | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | -| `npm run astro -- --help` | Get help using the Astro CLI | - -## πŸ‘€ Want to learn more? - -Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). +Built and deployed to Cloudflare Pages by the Gitea Actions workflow on +every push to `main` β€” there's no manual deploy step. diff --git a/docs/verify-manual.py b/docs/verify-manual.py index 74d6c94..c91ae27 100644 --- a/docs/verify-manual.py +++ b/docs/verify-manual.py @@ -338,7 +338,9 @@ def test_prettify_splits_an_entry_block(): ) out = build_manual.prettify(body, "rm") - assert "```fish\nrm [-e | args...]\n```" in out, "synopsis was not fenced as fish" + assert '```fish title="rm.fish"\nrm [-e | args...]\n```' in out, ( + "synopsis was not fenced as fish with a filename title" + ) assert "```fish\nrm file.txt" in out, "examples were not fenced as fish" assert out.count("```") == 4, f"expected exactly two fences, got:\n{out}" assert "\nSafe rm wrapper routing to trash:" in out, "description stayed indented"