fix(docs): move pandoc metadata out of index.md frontmatter

index.md is both the man-page LANDING section and a Starlight content
page. Astro errors on any frontmatter key outside the fixed
man/site/manTitle/helpKeywords schema, so folding the source
fish-config.md pandoc header (title/section/header/date/author) onto
index.md under a fifth "pandoc" key would break the docs-site build
the moment it's scaffolded.

Relocate that block to docs/manual/_pandoc.yml: a plain, fence-free
YAML file that Astro content collections ignore (leading underscore).
split-manual.py now extracts it as raw text (no yaml.safe_load/
safe_dump round-trip) so build-manual.py's --concat re-emits it
byte-for-byte instead of merely "verbatim" in comment only. Also guard
build_concat against a manual/ tree with no _pandoc.yml/index.md,
removing the unconditional index.md parse that previously raised
FileNotFoundError on such a tree.

Regenerated docs/manual/ via split-manual.py; concat output remains
byte-identical to the pre-migration docs/fish-config.md.
This commit is contained in:
2026-07-25 21:52:54 -04:00
parent 63e71ac9dd
commit beb89e406a
4 changed files with 43 additions and 23 deletions
+9 -11
View File
@@ -11,8 +11,6 @@ import argparse
import sys
from pathlib import Path
import yaml
import manualtools as mt
DOCS = Path(__file__).parent
@@ -25,17 +23,17 @@ def build_concat(root: Path) -> str:
Each file contributes `# {manTitle or title}` at a level matching its
depth, and its body headings are demoted by the same amount.
The root `index.md` (the LANDING page) may carry a `pandoc` key in its
frontmatter — the original document's pandoc metadata block
(title/section/header/date/author). If present, it is re-emitted
verbatim as the leading `---`-fenced block, ahead of every heading.
`root / "_pandoc.yml"` (if present) holds the original document's
pandoc metadata block (title/section/header/date/author) as raw text,
with no frontmatter fences and no Astro-visible frontmatter key. When
present, its contents are re-emitted byte-for-byte as the leading
`---`-fenced block, ahead of every heading.
"""
chunks: list[str] = []
index_fm, _ = mt.parse(root / "index.md")
pandoc_meta = index_fm.get("pandoc")
if pandoc_meta:
header = yaml.safe_dump(pandoc_meta, sort_keys=False, allow_unicode=True).rstrip()
chunks.append(f"---\n{header}\n---")
pandoc_path = root / "_pandoc.yml"
if pandoc_path.exists():
raw = pandoc_path.read_text().rstrip("\n")
chunks.append(f"---\n{raw}\n---")
for path, depth in mt.walk(root):
fm, body = mt.parse(path)
if not fm.get("man", True):