docs(site): replace starter README and title synopsis fences
Swap the Starlight scaffold README for one describing this project's two-source SSOT and dev/deploy workflow. Give the generated function synopsis fence a Starlight filename title (`fish title="name.fish"`) so it reads as a snippet of the function it documents.
This commit is contained in:
@@ -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 + [""]:
|
||||
|
||||
+25
-40
@@ -1,49 +1,34 @@
|
||||
# Starlight Starter Kit: Basics
|
||||
# fish-config docs site
|
||||
|
||||
[](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.
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user