Skip to content

jaredhughes/commentary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ“ Commentary

CI VS Code Marketplace

Inline comments for rendered Markdown in VS Code. Select text, add comments, and send feedback to your AI agentβ€”without touching the source file.

πŸ“Ή Watch Demo Video (downloads when clicked)


Why Commentary?

Stay in flow while reviewing your Markdown. Commentary brings Google Docs-style commenting to rendered previews in VS Code. Review documentation as readers will see it, annotate without editing source files, and send feedback directly to your AI agent.

Perfect for:

  • πŸ“– Documentation writers reviewing drafts
  • ✍️ Technical writers collecting feedback
  • πŸ‘₯ Content reviewers annotating without commits
  • πŸ€– AI-assisted workflows with Claude Code, Cursor Agent, Codex, or Gemini

✨ Features

Non-Destructive Comments

  • Text selection β€” Highlight any text to comment
  • Document-level β€” Comment on entire files
  • Floating bubble UI β€” Google Docs-style comment interface
  • Keyboard shortcuts β€” ⌘Enter / Ctrl+Enter to save, Esc to cancel
  • Visual highlights β€” See exactly what's commented

AI Agent Integration

CLI Tools (Send) β€” Recommended

  • Claude Code β€” Terminal integration, stays open for continued interaction
  • Cursor Agent β€” Terminal integration, stays open for continued interaction
  • Codex CLI β€” Terminal integration with automation mode
  • Gemini CLI β€” Terminal integration with Google's AI

Manual (Copy)

  • Claude IDE β€” Clipboard copy, paste into Claude chat
  • Cursor IDE β€” Clipboard copy, paste into Cursor chat
  • VS Code Chat β€” Clipboard copy, paste into built-in chat

πŸ’‘ CLI methods pipe comments to agentic tools that automatically apply edits and stay open for follow-up. Manual methods copy to clipboard for you to pasteβ€”useful when CLI isn't available.

Mermaid Diagrams

Render diagrams directly in your Markdown preview:

  • Flowcharts β€” Process flows and decision trees
  • Sequence diagrams β€” API interactions and workflows
  • Class diagrams β€” Architecture documentation
  • State diagrams β€” State machines and transitions
  • Pie charts β€” Data visualization
  • And more β€” Entity relationships, Git graphs, timelines

Diagrams automatically adapt to your VS Code theme (light/dark).

Beautiful Themes

Choose from 20 professional themes:

  • Water.css β€” Modern, clean (light/dark)
  • Sakura β€” Elegant (5 variants)
  • Pico CSS β€” Professional with accents (8 colors, auto light/dark)
  • Simple.css β€” Minimalist (auto light/dark)
  • Matcha β€” Code-focused with syntax highlighting
  • LaTeX.css β€” Academic paper styling
  • Tufte CSS β€” Edward Tufte design principles
  • New.css β€” Modern minimal (4k+ GitHub stars)

Quick switcher: βŒ˜β‡§P β†’ Commentary: Select Theme

Smart Storage

  • Workspace mode (default) β€” Comments in VS Code state (git-ignored)
  • Sidecar mode β€” Comments in .comments/ folder (git-tracked, shareable)

Reliable Anchoring

Comments survive document edits with 3-layer fallback:

  1. Exact quote + context (100 chars before/after)
  2. Character offset for fast recovery
  3. Nearest heading + fuzzy search

πŸš€ Quick Start

  1. Install from VS Code Marketplace
  2. Open any Markdown (.md) file
  3. Right-click the file in Explorer β†’ "Open with Commentary"
  4. Select text in the rendered preview β†’ floating comment bubble appears
  5. Type comment β†’ Press ⌘Enter (Mac) / Ctrl+Enter (Windows/Linux) to save
  6. View all comments in the Commentary sidebar β†’ βŒ˜β‡§C / Ctrl+Shift+C

Pro tip: After adding comments, send them to your AI agent! Automatic methods apply edits directly; manual methods copy to clipboard.

Configure AI Agent

βŒ˜β‡§P β†’ Commentary: Configure AI Agent

CLI Tools (Recommended):

  • Claude Code β€” Enter command: claude (default, installs automatically)
  • Cursor Agent β€” Enter path: cursor-agent (requires installation)
  • Codex CLI β€” Enter path: codex (requires installation)
  • Gemini CLI β€” Enter path: gemini (requires installation)

For Manual Copy-Paste:

  • Claude IDE β€” Choose "Claude" provider (uses clipboard when CLI unavailable)
  • Cursor IDE β€” Choose "Cursor" provider (uses clipboard when CLI unavailable)
  • VS Code Chat β€” Built-in chat (uses clipboard)

Advanced:

  • Custom β€” Your own API endpoint

πŸ“¦ Installation

From Marketplace

Install directly from the VS Code Marketplace:

  1. Open VS Code
  2. Go to Extensions view (βŒ˜β‡§X / Ctrl+Shift+X)
  3. Search for "Commentary"
  4. Click Install

Or install via command line:

code --install-extension jaredhughes.commentary

From Source

git clone https://github.com/jaredhughes/commentary
cd commentary
npm install
npm run compile

Press F5 in VS Code to launch Extension Development Host.


Usage

Creating Comments

Text Selection Comments:

  1. Select any text in the rendered Markdown preview
  2. A floating comment bubble appears
  3. Type your comment
  4. Press ⌘Enter (Mac) or Ctrl+Enter (Windows/Linux) to save
  5. Press Esc to cancel

Document-Level Comments: You can comment on an entire document without selecting text:

  • In the preview: Click the note icon button in the top-left corner of the preview
  • In the sidebar: Click the note icon in the Commentary sidebar toolbar
  • Command Palette: Press βŒ˜β‡§P (Mac) or Ctrl+Shift+P (Windows/Linux), then type "Add Document-Level Comment"

Managing Comments

View All Comments:

  • Open the Commentary sidebar: βŒ˜β‡§C / Ctrl+Shift+C
  • Comments are organized by file
  • Click a comment to navigate to its location in the document

Edit a Comment:

  • In the sidebar, click the edit icon next to the comment
  • Or click the comment text to navigate and edit in the preview

Delete Comments:

  • Single comment: Click the trash icon next to the comment in the sidebar
  • All comments: Click the trash icon in the sidebar toolbar (with confirmation)

Export/Import:

  • Use the export/import commands to backup or share comments as JSON

Sending Comments to AI Agent

Commentary supports two types of agent integration: CLI tools (Send) and manual (Copy).

CLI Tools (Send) β€” Recommended

These methods pipe comments to agentic tools via terminal, automatically apply edits to your files, and stay open for follow-up interaction:

  • Claude Code β€” Opens terminal with claude command, session stays open after processing
  • Cursor Agent β€” Opens terminal with cursor-agent command, session stays open after processing
  • Codex CLI β€” Opens terminal with codex exec command for automation mode
  • Gemini CLI β€” Opens terminal with gemini -p command for non-interactive prompts

Behavior:

  • Comments are piped to the CLI tool via stdin
  • Agent reviews the full document context and applies edits automatically
  • Sessions stay open for continued conversation and refinement
  • Comments are deleted from the sidebar after successful delivery (they've been processed)

Manual Methods (Copy)

These methods copy comments to your clipboard for you to paste manually:

  • Claude IDE β€” Copies to clipboard, paste into Claude chat (fallback when CLI unavailable)
  • Cursor IDE β€” Copies to clipboard, paste into Cursor Composer/Chat (fallback when CLI unavailable)
  • VS Code Chat β€” Copies to clipboard, paste into built-in VS Code Chat

Behavior:

  • Comments are formatted and copied to clipboard
  • You paste them into your agent's chat interface
  • Comments remain in the sidebar for tracking (you manually apply edits)

How to Use

Send a Single Comment:

  • In the sidebar, click the send/copy icon next to any comment
  • Icon varies by method: send (CLI providers), copy (clipboard mode)

Send All Comments:

  • Click the send/copy icon in the sidebar toolbar
  • All comments are sent together with full document context

Which Method is Used?

  • Commentary automatically chooses the best available method based on your configuration
  • CLI/API methods are preferred (automatic editing)
  • Clipboard methods are used as fallback (manual paste required)

βš™οΈ Configuration

Theme

{
  "commentary.theme.name": "water-dark"
}

Storage

{
  "commentary.storage.mode": "workspace"  // or "sidecar"
}

AI Agent

{
  "commentary.agent.enabled": true,
  "commentary.agent.provider": "claude",
  "commentary.agent.claudeCliPath": "claude",
  "commentary.agent.cursorCliPath": "cursor-agent",
  "commentary.agent.cursorInteractive": true,
  "commentary.agent.codexCliPath": "codex",
  "commentary.agent.geminiCliPath": "gemini",
  "commentary.agent.contextLines": 6
}

Settings scope: All settings default to global/user but can be overridden per-workspace.


πŸ”’ Security Considerations

When you send comments to AI CLI tools, those tools need permission to modify files in your workspace. Each tool handles this differently:

CLI Tool Permission Model
Claude Code Uses --permission-mode bypassPermissions flag to skip interactive prompts
Cursor Agent Inherits app-level settings (Auto-run, Auto-apply edits) from Cursor
Codex CLI Uses exec subcommand for automation mode
Gemini CLI Uses -p flag for non-interactive prompts

Best practices:

  • Review all changes in git before committing (git diff)
  • Use workspace-level git to track and revert unwanted changes
  • Consider running in a separate branch for large refactoring tasks
  • Keep your AI CLI tools updated for latest security patches

Why this is necessary: CLI tools require non-interactive mode to process comments programmatically. Interactive permission prompts would cause the terminal to hang waiting for input that never comes.


πŸ“‹ Commands

Command Action
Commentary: Configure AI Agent Set up Claude, Cursor, Codex, Gemini, or custom
Commentary: Select Theme Choose from 20 themes
Commentary: Add Document-Level Comment Comment on entire file
Commentary: Send All to Agent Batch send all comments
Commentary: Delete All Clear all (with confirmation)
Commentary: Export / Import Backup or share comments

πŸ—οΈ Architecture

src/
β”œβ”€β”€ extension.ts         # Activation & provider detection
β”œβ”€β”€ preview/             # Webview + overlay integration
β”œβ”€β”€ sidebar/             # Tree view + commands
β”œβ”€β”€ agent/               # AI provider abstraction
└── storage/             # Workspace + sidecar persistence

media/
β”œβ”€β”€ overlay.js           # Selection UI + comment bubbles
β”œβ”€β”€ overlay.css          # Visual styles
└── themes/              # 20 CSS themes (copied from NPM)

Design principles:

  • Pure provider logic (no VS Code APIs in core)
  • Testable AI integrations (208 passing tests)
  • Pluggable storage backends
  • Non-destructive annotations

πŸ§ͺ Development

Build & Test

npm install              # Install deps + theme packages
npm run compile          # Copy themes + compile TypeScript
npm run watch            # Auto-recompile on changes
npm test                 # Run all tests (208 passing)
npm run validate         # Lint + type check

Debug

Press F5 to launch Extension Development Host with debugger attached.

CI/CD

  • βœ… Automated linting, type checking, tests on every PR
  • βœ… Pre-push hooks catch issues before pushing
  • βœ… Multi-platform testing (macOS, Linux, Windows)

🀝 Contributing

Contributions welcome! Please open an issue first to discuss changes.

Workflow:

  1. Fork & create feature branch
  2. Make changes
  3. Run npm run validate && npm test
  4. Submit PR

πŸ“„ License

MIT License β€” Copyright (c) 2025 Jared Hughes

See LICENSE for details.


πŸ™ Credits

Themes powered by:

Diagrams powered by:

Special thanks to the VS Code extension API and markdown-it ecosystem.


Inline comments for rendered Markdown, without touching your files.

About

Review, comment, and AI-edit rendered Markdown in VS Code, Cursor, and Windsurf

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •