from __future__ import annotations from pathlib import Path def write_markdown_file( text: str, destination: Path, language: str, mode: str, page_count: int, ) -> Path: body = (text or "").strip() header = ( f"# Document OCR\n\n" f"- Language: `{language}`\n" f"- Mode: `{mode}`\n" f"- Pages: `{page_count}`\n\n" f"---\n\n" ) destination.write_text(header + body + "\n", encoding="utf-8") return destination