docs(site): replace starter README and title code fences throughout the manual #75
@@ -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.
|
# keep the whole thing in one fence rather than orphaning the rest.
|
||||||
while lines and lines[0].startswith(" "):
|
while lines and lines[0].startswith(" "):
|
||||||
synopsis.append(lines.pop(0).strip())
|
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] = []
|
para: list[str] = []
|
||||||
for line in lines + [""]:
|
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.
|
||||||
|
|
||||||
```
|
## Generated, not authored
|
||||||
npm create astro@latest -- --template starlight
|
|
||||||
|
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:
|
```fish title="local dev server"
|
||||||
|
cd docs/site
|
||||||
```
|
npm install
|
||||||
.
|
npm run dev
|
||||||
├── public/
|
|
||||||
├── src/
|
|
||||||
│ ├── assets/
|
|
||||||
│ ├── content/
|
|
||||||
│ │ └── docs/
|
|
||||||
│ └── content.config.ts
|
|
||||||
├── astro.config.mjs
|
|
||||||
├── package.json
|
|
||||||
└── tsconfig.json
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
Built and deployed to Cloudflare Pages by the Gitea Actions workflow on
|
||||||
|
every push to `main` — there's no manual deploy step.
|
||||||
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).
|
|
||||||
|
|||||||
@@ -338,7 +338,9 @@ def test_prettify_splits_an_entry_block():
|
|||||||
)
|
)
|
||||||
out = build_manual.prettify(body, "rm")
|
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 "```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 out.count("```") == 4, f"expected exactly two fences, got:\n{out}"
|
||||||
assert "\nSafe rm wrapper routing to trash:" in out, "description stayed indented"
|
assert "\nSafe rm wrapper routing to trash:" in out, "description stayed indented"
|
||||||
|
|||||||
Reference in New Issue
Block a user