(path: Path, body: str)
| 379 | |
| 380 | |
| 381 | def page_title(path: Path, body: str) -> str: |
| 382 | heading = re.search(r"^#\s+(.+)$", body, flags=re.MULTILINE) |
| 383 | if heading: |
| 384 | return re.sub(r"\s+", " ", heading.group(1)).strip() |
| 385 | if path.name == "index.md": |
| 386 | return path.parent.name.replace("-", " ").title() or "Home" |
| 387 | return path.stem.replace("-", " ").title() |
| 388 | |
| 389 | |
| 390 | def frontmatter( |
no outgoing calls
no test coverage detected