← ClaudeAtlas

hackmd-synclisted

Mirror research-cards collections to HackMD (the plugin's third note surface, aimed at sharing/publishing): incremental forward sync from the active backend (heptabase/obsidian/both) into HackMD folders with real note-to-note links, plus OPTIONAL level-2 write-back (config hackmd.write_back) — HackMD-side edits on owner-writable notes merge back into the vault paragraph-by-paragraph; shared-writable notes and two-sided edits stay conflicts. Use when the user asks to sync/publish cards to HackMD, 同步到 HackMD、把總覽卡發到 HackMD、鏡像到 hackmd、雙向同步 hackmd、check HackMD drift, or set up the hackmd section of the config.
SungFeng-Huang/research-cards · ★ 3 · AI & Automation · score 76
Install: claude install-skill SungFeng-Huang/research-cards
# hackmd-sync — 把卡片庫鏡像到 HackMD > **已併入 [note-sync]**:日常請用 `skills/note-sync/sync.py`(單一入口、全鏈編排+衝突彙總;`--mode hackmd` 等價單跑本段)。本檔保留引擎語義的完整說明;引擎 `sync.py` 檔案原位不動。 第三個筆記介面,定位是**分享**:把選定的 collection(典型是 overviews) 發佈成 HackMD notes,互連卡變成真的 note-to-note 連結。語義 (與 heptabase-sync 引擎的演進史同款): - **前向增量**:本地 backend 為準;來源 markdown md5 沒變就跳過。 `both` 時來源刻意取 **obsidian 側**(vault)而非 Heptabase——寫回落在 純 .md,再由 heptabase 段的區塊級二級送回 Heptabase(星狀中樞 的鏈,不重複造引擎)。 - **變更偵測**:HackMD 端的 `lastChangedAt` 在上次同步後動了 → 進入 level 2 判定(下條)或報 conflict、**不覆蓋**。 - **Level 2 寫回(選配,config `hackmd.write_back: true`)**:HackMD 端 的編輯寫回 vault。**���任邊界=只寫回有效 `write_permission` 為 owner 的 note**(HackMD 上只有你能編輯的);開放編輯的 note 永遠只報衝突。 兩邊都改=真三方衝突不動。合併是**段落級**:沒動的段落保留 vault 原文(降級成純文字的 mention 不會被固化),動過的段落連結逆向 (HackMD 連結→wikilink)+round-trip 驗證,會變形就**整卡凍結**報 conflict。寫回需要 base 快照(前向時自動維護;升級後先跑一輪前向)。 - **連結改寫**:`[[wikilink]]`/card mention/Heptabase URL 的目標若也 在鏡像集合裡 → 改成 `[標題](https://hackmd.io/<noteId>)`;不在 → 退化成純文字標題。 ## 前置 1. `npm install -g @hackmd/hackmd-cli` 2. Token(hackmd.io → Settings → API → Create API token): `hackmd-cli login` 一次(存 `~/.hackmd/config.json`)或設 `HMD_API_ACCESS_TOKEN` env——**token 絕不放 research-cards config**。 3. Config `hackmd` 段(`setup` skill 可帶你設;`hackmd-cli folders` 查 folder id): ```json "hackmd": { "collections": { "overviews": { "folder_id": "<folder-id>" }, "projects": { "folder_id": "<folder-id>", "read_permission": "own