API and export support for comments and reactions

未关闭
#428 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
git, github

调研方向

Issue 中没有确定实现文件或测试。首先检查 API v1、hackmd-cli export 和 GitHub sync 的入口点,然后确定评论、回复、反应和范围是如何表示的。完成这项工作需要达成一致的范围,并实现涵盖所提议 API 以及导出或同步行为的功能。

由索引模型根据 Issue 内容生成。

描述

Problem

Comments and reactions are first-class collaboration features in HackMD — the new commenting system introduced in 2024 added emoji reactions, a dedicated side panel, and expanded character limits. However, none of this data is accessible through the API, CLI, GitHub sync, or any export format.

Teams that use HackMD as part of a GitHub-centered documentation workflow lose all review context (feedback, questions, decisions captured in comment threads) when syncing notes to their repository. The comments are effectively trapped on the HackMD platform with no way to extract them.

Use Case

Our team recently migrated from Google Docs to a stack of HackMD + GitHub + Obsidian for collaborative documentation. HackMD replaced Google Docs as the real-time collaboration layer, with GitHub as the source of truth.

On Google Docs, comments traveled with the document — they could be exported, and the full discussion history was preserved. On HackMD, comments and reactions are silently dropped the moment a note is synced to GitHub. This is the single biggest gap in our workflow, and the main reason we can't fully move off Google Docs.

Current State

  • API v1: No endpoints for retrieving comment or reaction data. The only comment-related field is commentPermission (who can comment), but actual comment content is inaccessible.
  • CLI (hackmd-cli export): Outputs note.content only — raw markdown, no comments.
  • GitHub sync: Pushes markdown content as commits. Comments and reactions are not included.
  • All export formats (PDF, Dropbox, Google Drive, Arweave): Omit comments entirely.

Proposed Solution

Tier 1: API endpoints (highest priority)

New REST endpoints to retrieve comment and reaction data:

GET /v1/notes/:noteId/comments
GET /v1/notes/:noteId/reactions

Suggested comment response schema:

[
  {
    "id": "comment-id",
    "author": {
      "id": "user-id",
      "name": "Display Name"
    },
    "body": "Comment text content",
    "createdAt": "2025-01-15T10:30:00Z",
    "updatedAt": "2025-01-15T10:30:00Z",
    "resolved": false,
    "range": {
      "startLine": 42,
      "endLine": 44
    },
    "replies": [
      {
        "id": "reply-id",
        "author": { "id": "user-id", "name": "Display Name" },
        "body": "Reply text",
        "createdAt": "2025-01-15T11:00:00Z"
      }
    ],
    "reactions": [
      {
        "emoji": "👍",
        "users": ["user-id-1", "user-id-2"]
      }
    ]
  }
]
Tier 2: CLI export flag
hackmd-cli export --noteId=<id> --include-comments

This would output a sidecar .comments.json file alongside the markdown content, enabling scripted workflows and backups.

Tier 3: GitHub sync enrichment

Option to sync comments alongside note content, either as:

  • A sidecar .comments.json committed to the repo, or
  • Mapped to GitHub PR review comments (for notes synced via PR workflow)

Prior Art

  • Google Docs: Export includes comments; Google Docs API provides full comment/reply access
  • Notion API: GET /v1/comments endpoint exposes all comments on a page
  • GitHub: Issues and PR APIs expose all comments and reactions

Impact

This is a blocker for teams that want to use HackMD's collaboration features while maintaining durable records of discussion. Without it, the collaboration context that makes HackMD valuable over a plain text editor is ephemeral and lost.

Related: #207

主要语言
没有语言数据
星标
40
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hackmdio/hackmd-io-issues 的其他 Issue

查看 hackmdio/hackmd-io-issues 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。