MCPcopy Create free account
hub / github.com/Qinbf/groundmap / write_md

Function write_md

scripts/tests/conftest.py:40–46  ·  view source on GitHub ↗

便捷工具:写一个标准 wiki .md 文件(含 frontmatter)。

(path: Path, frontmatter_dict: dict, body: str)

Source from the content-addressed store, hash-verified

38
39
40def 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
49def standard_fm(**overrides) -> dict:

Calls

no outgoing calls

Tested by

no test coverage detected