HTML Commenter

A vanilla JS drop-in annotation system for static HTML pages

HTML Commenter is a zero-dependency, self-contained document annotation tool for any static HTML page. This system allows users to annotate the text on a web page, auto-saves their comments to local storage, and lets them share their comments with others via compressed links or back them up with JSON files, all without requiring a server or external libraries.

The goal of this project is to provide a lightweight collaborative document annotation experience for people who:

Core Features

Installation

Adding this system to any existing HTML page is a simple three-step process:

  1. Add the HTML: Copy the HTML for the UI elements and paste it right before the closing </body> tag in your file. This includes the main UI container, the corner widget, and the comment summary section.

  2. Add the CSS: Copy the entire <style>...</style> block and paste it inside your <head> tag or right before the HTML you just added.

  3. Add the JavaScript: Copy the entire final <script>...</script> block and paste it at the very end of your file, right before the closing </body> tag and after the UI HTML.

    Important: The script initializes itself by targeting the element with the ID content. If your main text container has a different ID, simply change the last line of the script:

    // Change 'content' to the ID of your main text container
    document.addEventListener('DOMContentLoaded', () => {
      initializeCommentingSystem('your-content-id-here');
    });
    

That's it! Your page now has a complete annotation system.

Vibe Coding Disclaimer

When I do AI-assisted coding I use agentic systems to maintain tigher control with finer-grained changes, and I usually read every diff, design every architecture and algorithm decision before I even talk to the LLM, and I'm very careful and picky. Not so here. I did this straight in a Gemini 2.5 Pro chat and literally didn't look at the code at all. So take that as you will. I'm not claiming this is my work, just that it's a really useful little tool for me, to replace the only thing I use Google Docs for, and someone might find it useful too.

Comments are stored locally in your browser. Use Export/Import or Copy Link to share.
Shift + Enter to save, Esc to cancel