便捷工具:写一个标准 wiki .md 文件(含 frontmatter)。
(path: Path, frontmatter_dict: dict, body: str)
| 38 | |
| 39 | |
| 40 | def write_md(path: Path, frontmatter_dict: dict, body: str) -> None: |
| 41 | """便捷工具:写一个标准 wiki .md 文件(含 frontmatter)。""" |
| 42 | import yaml |
| 43 | |
| 44 | path.parent.mkdir(parents=True, exist_ok=True) |
| 45 | fm = yaml.safe_dump(frontmatter_dict, allow_unicode=True, sort_keys=False).strip() |
| 46 | path.write_text(f"---\n{fm}\n---\n\n{body}\n", encoding="utf-8") |
| 47 | |
| 48 | |
| 49 | def standard_fm(**overrides) -> dict: |
no outgoing calls
no test coverage detected