MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / write_full_text_markdown

Function write_full_text_markdown

scripts/extract_source_text.py:265–281  ·  view source on GitHub ↗
(records: list[dict[str, Any]], output_path: str, title: str)

Source from the content-addressed store, hash-verified

263
264
265def write_full_text_markdown(records: list[dict[str, Any]], output_path: str, title: str) -> None:
266 ensure_parent(output_path)
267 lines = [f"# {title or 'Full Source Text'}", ""]
268 for record in records:
269 lines.extend(
270 [
271 f"## {record.get('section_id', '')} {record.get('title', '')}".strip(),
272 f"_Pages {record.get('page_start')}-{record.get('page_end')}_",
273 "",
274 str(record.get("text", "")).strip(),
275 "",
276 ]
277 )
278 Path(output_path).expanduser().resolve().write_text(
279 "\n".join(lines).rstrip() + "\n",
280 encoding="utf-8",
281 )
282
283
284def build_manifest(

Callers 1

mainFunction · 0.85

Calls 1

ensure_parentFunction · 0.90

Tested by

no test coverage detected