The @docmd/plugin-threads plugin enables collaborative inline commenting and text annotation across documentation pages. Highlights and discussion threads are stored natively inside Markdown source files using custom container blocks (::: threads). No external database is required.

Original Author: @svallory

Alpha Release

This plugin is currently in Alpha. Core APIs and storage schemas are stable, whilst UI components are undergoing active iteration.

Installation & Setup

Install the plugin via CLI:

npx @docmd/core add threads

Enable thread configuration in docmd.config.json:

Option Type Default Technical Description
sidebar boolean false When true, threads display in a dedicated panel; when false, threads attach inline to text highlights.

Global Configuration Example

docmd.config.json
{
  "plugins": {
    "threads": {
      "sidebar": true
    }
  }
}

Workflow Overview

  1. Text Selection: Select prose during local live development (npx @docmd/core dev).
  2. Comment Popover: Enter feedback in the popover modal.
  3. Anchor Injection: Selected prose is highlighted with a thread identifier (==highlighted text=={t-a1b2c3d4}).
  4. Markdown Persist: Thread structures append to the bottom of the Markdown file as a ::: threads block.
  5. Git Synchronization: Discussion history is saved in source control alongside document edits.

Interactive Preview

Text with attached discussions receives inline color highlights. Thread cards render below:

A
Alice · 2d ago
This section could use a diagram to explain the architecture. What do you think?
B
Bob · 1d ago
Good idea - I'll add a Mermaid flowchart. Does sequenceDiagram work here?
👍 2
🚀 1
A
Alice · 12h ago
Perfect. A simple flowchart would be ideal.

Additional highlights cycle through distinct color palettes automatically:

C
Charlie · 3d ago
Should we mention backward compatibility here?

Resolved discussions display in a dimmed state:

A
Alice · 5d ago  ✓ Resolved
Fixed the typo in the config example.

A floating discussion trigger 💬2 displays unresolved thread counts in the bottom corner.

Markdown Storage Format

Threads are saved inside document source files using container block syntax:

# Engine Overview

Core architecture features ==highlighted text=={t-a1b2c3d4} with an attached thread.

::: threads
  ::: thread t-a1b2c3d4
    ::: comment c-e5f6a7b8 "Alice" "2026-04-09"
      This text requires additional technical detail.
    :::
    ::: comment c-d9e0f1a2 "Bob" "2026-04-09" reply-to c-e5f6a7b8
      Updated with extra specifications.

      ::: reactions
        - 👍 Alice
      :::
    :::
  :::
:::

Core Features

  • Text Selection: Highlight arbitrary prose to anchor new threads.
  • Threaded Replies: Nested conversation threads.
  • Emoji Reactions: Add reaction counters to comments.
  • Resolution State: Mark threads as resolved with author attribution.
  • Author Identity: Local Git credentials resolve avatar and profile details automatically.

RPC Actions API

The Threads plugin exposes WebSocket RPC endpoints accessible via docmd.call():

RPC Method Technical Description
threads:get-threads Retrieve all parsed threads for a given file path.
threads:add-thread Anchor a new thread and initial comment.
threads:add-comment Append a reply to an existing thread.
threads:edit-comment Update comment text body.
threads:delete-comment Remove a comment entry.
threads:delete-thread Remove thread container and clean up body highlight anchors.
threads:resolve-thread Toggle thread resolution state.
threads:toggle-reaction Add or remove emoji reactions.

Author Profile Storage

Author profiles are cached in <docsRoot>/.threads/authors.json:

.threads/authors.json
{
  "alice@example.com": {
    "name": "Alice",
    "avatarUrl": "https://gravatar.com/avatar/..."
  }
}
Git-Native Versioning

Because thread metadata resides entirely inside .md files, comments follow standard Git branching, pull request reviews, and commit history workflows.