MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _sync_obsidian_toc

Function _sync_obsidian_toc

agents/reading-agent/main.py:2605–2617  ·  view source on GitHub ↗
(daily_note: Path)

Source from the content-addressed store, hash-verified

2603
2604def _sync_obsidian_toc(daily_note: Path) -> None:
2605 year_dir = daily_note.parent
2606 match = re.fullmatch(r"Daily Note - ([A-Za-z]+) (20\d{2})\.md", daily_note.name)
2607 if not match:
2608 return
2609 month_label, year = match.groups()
2610 toc = year_dir / f"Table of Content - {year}.md"
2611 link_name = daily_note.stem
2612 entry = f"# {link_name}\n[[{link_name}]]"
2613 current = toc.read_text(encoding="utf-8") if toc.exists() else ""
2614 if f"[[{link_name}]]" in current:
2615 return
2616 toc.write_text(current.rstrip() + ("\n" if current.strip() else "") + entry + "\n", encoding="utf-8")
2617
2618
2619def _save_reading_report_markdown(
2620 *,

Callers 2

refresh_daily_note_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected