143d2073cStracker-user# Annotations Plugin for DokuWiki 243d2073cStracker-user 38d8701f5Stracker-userWord- and sentence-level annotations on wiki pages, stored separately from the page text with threaded replies. Inspired by [Hypothes.is](https://hypothes.is/) and [ep_comments_page](https://github.com/ether/ep_comments_page). 443d2073cStracker-user 543d2073cStracker-user## Features 643d2073cStracker-user 78d8701f5Stracker-user- **Text-quote anchoring** — select any word or sentence; the annotation is tied to the quoted text plus its surrounding context, so it survives minor edits to the page. 8ee9dbf15Stracker-user- **Threaded replies** — any logged-in reader can reply to an annotation, or reply to another reply for a nested discussion. 98d8701f5Stracker-user- **Open / Resolved status** — mark a discussion closed; resolved annotations turn green. 1043d2073cStracker-user- **Gutter markers** — small icons in the left margin show at a glance where annotations live. 118d8701f5Stracker-user- **Orphan detection** — when the annotated text is removed from the page, the annotation is flagged as orphaned and stays reachable via the counter. Admins can bulk-delete orphans. 128d8701f5Stracker-user- **Per-user toggle** — turn the annotation overlay on or off from your user preferences. 138d8701f5Stracker-user- **No page revisions** — annotations live in a separate file per page; the wiki changelog is never touched. 14da56206cStracker-user- **Localised interface** — English, German, Russian and Japanese, falling back to English for any untranslated string. 1543d2073cStracker-user 1643d2073cStracker-user## Requirements 1743d2073cStracker-user 188d8701f5Stracker-user- DokuWiki Librarian 2025-05-14b (or a compatible release) 198d8701f5Stracker-user- PHP 8.0 or later with the `mbstring` extension 208d8701f5Stracker-user- [usersettings plugin](https://github.com/tracker-user/dokuwiki-usersettings) *(optional — adds the per-user on/off toggle)* 218d8701f5Stracker-user 228d8701f5Stracker-userWorks in current browsers and as far back as Firefox 78 ESR. 2343d2073cStracker-user 2443d2073cStracker-user## Installation 2543d2073cStracker-user 2643d2073cStracker-user1. Copy the `annotations/` directory into `{DokuWiki}/lib/plugins/`. 2743d2073cStracker-user2. If you want the per-user toggle, install the usersettings plugin too. 2886c7806dStracker-user3. The defaults work out of the box; tune them in the Configuration Manager if you like (see below). 2986c7806dStracker-user 3086c7806dStracker-user## Configuration 3186c7806dStracker-user 3286c7806dStracker-userAll settings live under **Admin → Configuration Settings → annotations**: 3386c7806dStracker-user 3486c7806dStracker-user| Setting | Default | What it does | 3586c7806dStracker-user|---------|---------|--------------| 3686c7806dStracker-user| `color_open` | `#f59e0b` | Highlight colour for open (unresolved) annotations. One hex value; lighter fills, gutter markers and status-pill tints are derived from it automatically. | 3786c7806dStracker-user| `color_resolved` | `#4ade80` | Highlight colour for resolved annotations. | 3886c7806dStracker-user| `embed_max_bytes` | `131072` | Largest annotation list (bytes) shipped inline with the page. Bigger lists load via a separate AJAX request instead, keeping every page view lean. | 3986c7806dStracker-user| `context_length` | `64` | Characters of surrounding text stored on each side of a quote, used to re-locate it after edits and to disambiguate repeated quotes. `0` disables context. | 4086c7806dStracker-user| `body_cap` | `10000` | Maximum length (characters) of an annotation or reply body; longer input is truncated. | 41*9fd890c3Stracker-user| `entries_per_page` | `25` | Rows per page in the **Admin → Annotations** overview of annotated pages. `0` shows every page on a single page. | 4243d2073cStracker-user 4343d2073cStracker-user## Usage 4443d2073cStracker-user 4543d2073cStracker-user### Reading annotations 4643d2073cStracker-user 4743d2073cStracker-userAnnotated text is highlighted in **amber** (open) or **green** (resolved). Click any highlight to open the thread panel inline below that paragraph. 4843d2073cStracker-user 498d8701f5Stracker-userThe counter bar above the page content shows how many annotations the page has. If some are orphaned (their text was deleted), a clickable "N orphaned" link opens a drawer at the bottom of the page with those threads. 5043d2073cStracker-user 5143d2073cStracker-user### Creating an annotation 5243d2073cStracker-user 5343d2073cStracker-user1. Select any text on the page. 5443d2073cStracker-user2. Click the **Annotate** button that appears. 5543d2073cStracker-user3. Type your comment and click **Annotate** to save. 5643d2073cStracker-user 578d8701f5Stracker-user> You only need to be logged in and able to *read* the page — edit access is **not** required. If you can read a page, you can annotate it. 5843d2073cStracker-user 5986c7806dStracker-userThe **Annotate** button only appears over real page prose. Selecting inside the table of contents, the page-info line, section-edit buttons, or the annotation panels does nothing. If your selection touches an existing annotation — even by a single character — that annotation opens instead of starting a new, overlapping one. 6086c7806dStracker-user 6143d2073cStracker-user### Replying 6243d2073cStracker-user 63ee9dbf15Stracker-userOpen the thread panel for any annotation and use the **Reply** field at the bottom. Each individual reply also has its own **Reply** button, so conversations can nest. Any logged-in reader can reply. 6443d2073cStracker-user 658d8701f5Stracker-user### Resolving / reopening 6643d2073cStracker-user 678d8701f5Stracker-userClick **Resolve** on an annotation to mark its discussion closed, or **Reopen** to undo that. Any logged-in reader can resolve or reopen. 6843d2073cStracker-user 6943d2073cStracker-user### Editing and deleting 7043d2073cStracker-user 718d8701f5Stracker-user- You can edit or delete your own annotations and replies. 728d8701f5Stracker-user- Admins can edit or delete anyone's. 7343d2073cStracker-user 7443d2073cStracker-user### Admin: bulk operations 7543d2073cStracker-user 7643d2073cStracker-userAdmins see two extra buttons in the counter bar: 7743d2073cStracker-user 7843d2073cStracker-user| Button | Effect | 7943d2073cStracker-user|--------|--------| 8043d2073cStracker-user| **Clear resolved** | Permanently deletes all resolved annotations on the page | 818d8701f5Stracker-user| **Clear orphaned** | Re-checks the page, then permanently deletes the orphaned annotations | 8243d2073cStracker-user 83*9fd890c3Stracker-user### Admin: annotated-pages overview 84*9fd890c3Stracker-user 85*9fd890c3Stracker-user**Admin → Annotations** lists every page that has annotations, with a **Normal** count 86*9fd890c3Stracker-user(annotations whose quoted text is still on the page) and an **Orphaned** count (annotations 87*9fd890c3Stracker-userwhose text was deleted from the page): 88*9fd890c3Stracker-user 89*9fd890c3Stracker-user- **Search** by page title or ID, and **sort** by page title, normal count, or orphaned count. 90*9fd890c3Stracker-user- **Clear orphaned** on a row removes just that page's orphaned annotations. 91*9fd890c3Stracker-user- **Clear all orphaned (N)** at the top removes orphaned annotations across every page at once. 92*9fd890c3Stracker-user 93*9fd890c3Stracker-userEach clear re-checks the page server-side before deleting, so the counts are authoritative even 94*9fd890c3Stracker-userif the page changed since it was last viewed. Long lists are paginated (`entries_per_page`). 95*9fd890c3Stracker-user 968d8701f5Stracker-user### Turning the overlay off 9743d2073cStracker-user 988d8701f5Stracker-userIn **User Preferences** (provided by the usersettings plugin), uncheck **Enable annotations**. The overlay is then hidden for you; your annotations are still stored and remain visible to everyone else. 9943d2073cStracker-user 10043d2073cStracker-user## License 10143d2073cStracker-user 10243d2073cStracker-userGPL 2, matching DokuWiki. 1038d8701f5Stracker-user 1048d8701f5Stracker-user--- 1058d8701f5Stracker-user 1068d8701f5Stracker-user**Developers & AI agents:** see **[DESIGN.md](DESIGN.md)** for the full technical reference — architecture, the text-quote anchoring algorithm, the JSON storage format, the JSINFO-injection mechanism, the permission model, the AJAX API, browser/PHP constraints, and known gaps. 107