Skip to content
Svartz v2.6.0

@svartz/plugin-annotations

20 exported symbols.

Interfaces

i AgreementSomeone who agreed with a comment with **+1**.
i AnchorHow a passage is found again: its quote, the text around it, and where it last was.
i AnnotationsOptionsThe `annotations` plugin's options.
i AnnotationsServerOptionsWhat the server module receives: the options with every default filled in.
i AttachOptions
i HostNoteOptionsA note in a host app's vault, which locates its annotations without spelling out the route or key.
i MountOptionsWhat the plugin's browser resource receives from the build.
i ReactionOne of the site's drawn reactions.
i ReportedCommentA comment as a report about it shows it to moderators, hidden or not.

Types

t AnnotationA comment or reaction on a passage, as `GET <mount>/_svartz/annotations/?page=` lists it.

Functions

f annotationsThe `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 attachShow 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 findCommentComment `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 mountBrowser 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_IDThe plugin id, and so the path segment its routes answer under: `<mount>/_svartz/annotations/`.
v defaultThe `annotations` server module: `server: { module, options }` with `AnnotationsServerOptions`.
v DEFAULT_WRITES_PER_HOURWrites each signed-in reader may make per hour unless `limits.writesPerHour` says otherwise.
v HIGHLIGHTHighlight names, for `::highlight(…)` in a host's own CSS.