feat(docs): expand functions/ and completions/ in the Starlight home tree

List every file in functions/ and completions/ inline under the home
page's file tree instead of a one-line summary. The listing is read
live off disk during --site generation, so it never needs manual
upkeep, and only affects the Starlight build — the plain-text
manual/man page (--concat) still renders the compact summary.
This commit is contained in:
2026-08-25 01:07:07 -04:00
parent 38924d5c3c
commit 82d78d19f5
2 changed files with 66 additions and 0 deletions
+11
View File
@@ -20,8 +20,14 @@ import generate_component_registry
DOCS = Path(__file__).parent
MANUAL = DOCS / "manual"
FUNCTIONS = DOCS.parent / "functions"
COMPLETIONS = DOCS.parent / "completions"
SLUG_DIR = "reference"
# File-tree branches whose real directory contents get listed inline on the
# Starlight site (never in the plain-text manual/man page, since only the
# --site path runs box-drawing trees through _as_file_tree).
EXPANDABLE_TREE_DIRS = {"functions/": FUNCTIONS, "completions/": COMPLETIONS}
def _is_function_page(path: Path, root: Path) -> bool:
"""True for a Section 5 category stub (not its index)."""
@@ -366,6 +372,11 @@ def _as_file_tree(para: list[str]) -> str | None:
depth = len(prefix.replace('\t', ' ')) // 4
indent = " " * (depth + 1)
out.append(f"{indent}- {name} {desc}".rstrip())
expand_dir = EXPANDABLE_TREE_DIRS.get(name)
if expand_dir is not None and expand_dir.is_dir():
child_indent = " " * (depth + 2)
for entry in sorted((p.name for p in expand_dir.iterdir() if p.is_file()), key=str.lower):
out.append(f"{child_indent}- {entry}")
out.append("</FileTree>")
return "\n".join(out)