feat(docs): render Specs table on each hardware host page
- Add scripts/mkdocs_hooks.py: on_page_markdown hook that prepends
`# {hostname}` + a Specs table built from the YAML frontmatter.
Reuses fmt_cpu/fmt_ram/fmt_storage/fmt_nic from gen_overview.py so
the host page and the index table stay in sync.
- Wire the hook into mkdocs.yml.
- Demote `# Notes` / `# ToDo` to `##` in the five host source files so
each rendered page has a single H1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
03b2430e7a
commit
b9722f082f
7 changed files with 46 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ storage_type: nvme
|
||||||
nic_gbps: 1
|
nic_gbps: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
# Notes
|
## Notes
|
||||||
|
|
||||||
Hetzner Cloud VPS running the public-facing MakerFLOSS stack: Forgejo
|
Hetzner Cloud VPS running the public-facing MakerFLOSS stack: Forgejo
|
||||||
(self-hosted git forge), Traefik with Let's Encrypt, poste.io mail
|
(self-hosted git forge), Traefik with Let's Encrypt, poste.io mail
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ storage:
|
||||||
nic_gbps: [1, 2.5, 10]
|
nic_gbps: [1, 2.5, 10]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Notes
|
## Notes
|
||||||
|
|
||||||
PCIe USB add-in card: ASMedia ASM2141/ASM3142
|
PCIe USB add-in card: ASMedia ASM2141/ASM3142
|
||||||
|
|
||||||
# ToDo
|
## ToDo
|
||||||
|
|
||||||
1. Update BIOS/UEFI firmware
|
1. Update BIOS/UEFI firmware
|
||||||
2. Update BIOS/UEFI settings
|
2. Update BIOS/UEFI settings
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ storage_type: nvme
|
||||||
nic_gbps: 1
|
nic_gbps: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
# Notes
|
## Notes
|
||||||
|
|
||||||
HP desktop.
|
HP desktop.
|
||||||
|
|
||||||
# ToDo
|
## ToDo
|
||||||
|
|
||||||
1. Update BIOS/UEFI firmware
|
1. Update BIOS/UEFI firmware
|
||||||
2. Update BIOS/UEFI settings
|
2. Update BIOS/UEFI settings
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ storage_type: nvme
|
||||||
nic_gbps: 1
|
nic_gbps: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
# Notes
|
## Notes
|
||||||
|
|
||||||
HP desktop.
|
HP desktop.
|
||||||
|
|
||||||
# ToDo
|
## ToDo
|
||||||
|
|
||||||
1. Update BIOS/UEFI firmware
|
1. Update BIOS/UEFI firmware
|
||||||
2. Update BIOS/UEFI settings
|
2. Update BIOS/UEFI settings
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ storage_type: hdd
|
||||||
nic_gbps: 1
|
nic_gbps: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
# Notes
|
## Notes
|
||||||
|
|
||||||
Old Gamer style PC
|
Old Gamer style PC
|
||||||
|
|
||||||
# ToDo
|
## ToDo
|
||||||
|
|
||||||
1. Update BIOS/UEFI firmware
|
1. Update BIOS/UEFI firmware
|
||||||
2. Update BIOS/UEFI settings
|
2. Update BIOS/UEFI settings
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ markdown_extensions:
|
||||||
plugins:
|
plugins:
|
||||||
- search
|
- search
|
||||||
|
|
||||||
|
hooks:
|
||||||
|
- scripts/mkdocs_hooks.py
|
||||||
|
|
||||||
nav:
|
nav:
|
||||||
- Home: index.md
|
- Home: index.md
|
||||||
- Hardware:
|
- Hardware:
|
||||||
|
|
|
||||||
34
scripts/mkdocs_hooks.py
Normal file
34
scripts/mkdocs_hooks.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
"""MkDocs build hook: render a Specs section on each hardware host page from its YAML frontmatter."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||||
|
from gen_overview import fmt_cpu, fmt_nic, fmt_ram, fmt_storage # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
|
def _render_specs(meta: dict) -> str:
|
||||||
|
rows = [
|
||||||
|
("Model", meta.get("model")),
|
||||||
|
("Location", meta.get("location")),
|
||||||
|
("CPU", fmt_cpu(meta)),
|
||||||
|
("RAM", fmt_ram(meta)),
|
||||||
|
("Storage", fmt_storage(meta)),
|
||||||
|
("NIC", fmt_nic(meta)),
|
||||||
|
("Status", meta.get("status")),
|
||||||
|
]
|
||||||
|
lines = ["| Field | Value |", "|---|---|"]
|
||||||
|
for label, value in rows:
|
||||||
|
if not value:
|
||||||
|
continue
|
||||||
|
lines.append(f"| {label} | {value} |")
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def on_page_markdown(markdown, page, config, files): # noqa: ARG001
|
||||||
|
meta = page.meta or {}
|
||||||
|
hostname = meta.get("hostname")
|
||||||
|
if not hostname:
|
||||||
|
return markdown
|
||||||
|
return f"# {hostname}\n\n## Specs\n\n{_render_specs(meta)}\n\n{markdown}"
|
||||||
Loading…
Add table
Reference in a new issue