Fix docs heading format for template compatibility

Convert (id, title) tuples to SimpleNamespace objects with id, text,
and level attributes to match template expectations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2025-12-31 23:10:34 -04:00
parent 8c7c22b958
commit 357997dc7d
1 changed files with 6 additions and 1 deletions

View File

@ -463,11 +463,16 @@ def docs(path: str):
# Get content from docs_content module # Get content from docs_content module
doc = get_doc(current) doc = get_doc(current)
if doc: if doc:
# Convert (id, title) tuples to objects with id, text, level attributes
headings = [
SimpleNamespace(id=h[0], text=h[1], level=2)
for h in doc.get("headings", [])
]
page = SimpleNamespace( page = SimpleNamespace(
title=doc["title"], title=doc["title"],
description=doc["description"], description=doc["description"],
content_html=Markup(doc["content"]), content_html=Markup(doc["content"]),
headings=doc.get("headings", []), headings=headings,
parent=doc.get("parent"), parent=doc.get("parent"),
) )
else: else: