@svartz/plugin-annotations
20 exported symbols.
Interfaces
| i Agreement | Someone who agreed with a comment with **+1**. |
| i Anchor | How a passage is found again: its quote, the text around it, and where it last was. |
| i AnnotationsOptions | The `annotations` plugin's options. |
| i AnnotationsServerOptions | What the server module receives: the options with every default filled in. |
| i AttachOptions | |
| i HostNoteOptions | A note in a host app's vault, which locates its annotations without spelling out the route or key. |
| i MountOptions | What the plugin's browser resource receives from the build. |
| i Reaction | One of the site's drawn reactions. |
| i ReportedComment | A comment as a report about it shows it to moderators, hidden or not. |
Types
| t Annotation | A comment or reaction on a passage, as `GET <mount>/_svartz/annotations/?page=` lists it. |
Functions
| f annotations | The `annotations` plugin: its routes on the server, and in the browser a script that attaches to every note body a theme marks with `data-svartz-note`, as theme-minimal and every theme extending it do. |
| f attach | Show the annotations stored for `page` beside `content`, the note's body element. Returns `detach`, which removes every marker, card, highlight and list it added. Comments whose passage is no longer in the note are listed after it. |
| f findComment | Comment `id` of `vault`, hidden or not, from the annotations stored in the D1 binding named `database`: what the moderation plugin shows beside a report about it. `undefined` when there's no such comment, or no such binding. |
| f findComments | `findComment` for each of `ids` in one query, by id, for a list of reports: ids with no such comment are absent, and so is every id when there's no such binding. |
| f mount | Browser resource entry, which Svartz calls after every navigation: attach to the note body marked with `data-svartz-note="<slug>"`, keyed by that slug. On a host page that is the `SvartzNoteContent` body the mount is for, so each of several notes gets its own; on a theme page, the document's. A page without one gets nothing. |
Variables
| v ACTIVE_HIGHLIGHT | |
| v ANNOTATIONS_PLUGIN_ID | The plugin id, and so the path segment its routes answer under: `<mount>/_svartz/annotations/`. |
| v default | The `annotations` server module: `server: { module, options }` with `AnnotationsServerOptions`. |
| v DEFAULT_WRITES_PER_HOUR | Writes each signed-in reader may make per hour unless `limits.writesPerHour` says otherwise. |
| v HIGHLIGHT | Highlight names, for `::highlight(…)` in a host's own CSS. |