This commit is contained in:
urieljarethbusiness-cpu
2026-05-17 10:14:14 -06:00
parent d8773b2508
commit 64b3d15b90
61 changed files with 7612 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
from __future__ import annotations
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
def build_markdown(title: str, body: str, metadata: dict[str, Any]) -> str:
frontmatter = {
**metadata,
"processed_at": datetime.now(timezone.utc).isoformat(),
}
lines = ["---"]
for key, value in frontmatter.items():
if value is not None:
safe_value = str(value).replace("\n", " ")
lines.append(f"{key}: {safe_value}")
lines.extend(["---", "", f"# {title}", "", body.strip(), ""])
return "\n".join(lines)
def title_from_path(path: Path) -> str:
return path.stem.replace("-", " ").replace("_", " ").strip().title() or "Documento"