Skip to content

Authorship marks

Who wrote each passage of a text, marked by a patterned rule and a word, shown by one switch.

  <div class="cap-authorship" data-cap="authorship" data-authorship="on" data-remember="off" id="au-on">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/authorship.css";
import { enhance } from "capsomer/behavior/authorship";

enhance();

Usage

<div class="cap-authorship" data-cap="authorship" data-authorship="on">
  <div class="cap-authorship-bar">
    <label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label>
    <div class="cap-meter cap-authorship-summary" data-cap-part="summary">
      <span class="cap-meter-label">Authorship</span>
      <span class="cap-meter-value" data-cap-part="text">62% you, 31% AI, 7% quoted by words</span>
      <span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="62"></span>…</span>
      <span class="cap-meter-note" data-cap-part="notes"><span>You: 412 words</span>…</span>
    </div>
  </div>
  <div class="cap-authorship-text">
    <div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>…</p></div>
    <p><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>an inline run </span>…</p>
  </div>
</div>
<Authorship>
  <Run kind="you" block><p>I wrote the queue first.</p></Run>
  <p><Run kind="you">I asked the agent, </Run><Run kind="ai">and it explained each suggestion.</Run></p>
</Authorship>

Examples

Hidden: plain prose

  <div class="cap-authorship" data-cap="authorship" data-authorship="off" data-remember="off" id="au-off">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" /> Show authorship <span class="cap-switch-state" aria-hidden="true">Off</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div>

Labels with an avatar

  <div class="cap-authorship" data-cap="authorship" data-authorship="on" data-remember="off" id="au-avatar">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label"><span class="cap-avatar" data-size="sm" aria-hidden="true"><span class="cap-avatar-fallback" aria-hidden="true">DE</span></span>You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label"><span class="cap-avatar" data-kind="ai" data-size="sm" aria-hidden="true"><span class="cap-avatar-fallback" aria-hidden="true">AI</span></span>AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div>

Remembered choice

  <div class="cap-authorship" data-cap="authorship" data-authorship="on" id="au-remember">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div>

Comfortable density

  <div data-density="comfortable"><div class="cap-authorship" data-cap="authorship" data-authorship="on" data-remember="off" id="au-comfortable">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div></div>

React: Authorship and Run

<div data-mount="react"></div>

Narrow container, labels above

  <main class="specimen-page">
    <h1>Narrow</h1>
    <div class="cap-authorship" data-cap="authorship" data-authorship="on" data-remember="off" id="au-narrow">
<div class="cap-authorship-bar"><label class="cap-switch" data-cap="switch"><input type="checkbox" role="switch" checked /> Show authorship <span class="cap-switch-state" aria-hidden="true">On</span></label><div class="cap-meter cap-authorship-summary" data-cap-part="summary"><span class="cap-meter-label">Authorship</span><span class="cap-meter-value" data-cap-part="text">35% you, 40% AI, 25% quoted by words</span><span class="cap-meter-bar" aria-hidden="true"><span class="cap-authorship-seg" data-kind="you" data-share="35"></span><span class="cap-authorship-seg" data-kind="ai" data-share="40"></span><span class="cap-authorship-seg" data-kind="quoted" data-share="25"></span></span><span class="cap-meter-note" data-cap-part="notes"><span>You: 37 words</span><span>AI: 42 words</span><span>Quoted: 26 words</span></span></div></div>
<div class="cap-authorship-text">
<div class="cap-run" data-kind="you"><span class="cap-run-label">You</span><p>I wrote the queue first and the rest second. Every mention arrives as a small note, and I read each one before it is shown.</p></div>
<div class="cap-run" data-kind="quoted"><span class="cap-run-label">Quoted</span><p>Every mention is untrusted until a person has looked at it. A link from a site nobody knows proves nothing about the page that sent it.</p></div>
<p><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>I ask the agent for a suggested order, </span><span class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span>and it explains each suggestion in one line. A suggestion is a note beside the mention, never a decision. </span><span class="cap-run" data-kind="you"><span class="cap-run-label">You</span>The decision stays mine.</span></p>
<div class="cap-run" data-kind="ai"><span class="cap-run-label">AI</span><p>The queue lists mentions newest first, shows the sender's address in full, and keeps every hidden mention so it can be restored later.</p></div>
</div>
</div>
  </main>

API reference

Run

PropTypeRequiredDoes
kindKindYes
blockbooleanA block (a div around paragraphs) rather than a span inside one.
badgeReactNodeSomething small before the word on the label: an Avatar with aria-hidden, for example.
childrenReactNode

Authorship

PropTypeRequiredDoes
shownbooleanControlled; leave both out and the component remembers the person's choice.
onShownChange(shown: boolean) => void
defaultShownbooleanShown unless the person chose otherwise. Default true.
rememberbooleanKeep the choice in localStorage (the uncontrolled default).
childrenReactNodeYesThe runs, as <Run>s inside your paragraphs.

Functions

FunctionSignatureDoes
summarize(runs: readonly RunInput[]): SummaryWord counts per kind, as percentages that add up to 100, and the sentence that says them.
summaryText(shares: Share[]): string
summaryHtml(summary: Summary, label?: string): stringThe summary as html, for a server to write: the line, the bar (drawn by enhance, which sets each segment's width), and the word counts in text.
collectRuns(root: Element): RunInput[]Every run's words, counted once: text inside a run belongs to the nearest run around it, a label never counts, and text outside any run is not marked so it is left out.
refresh(root: Element): SummaryCounts the runs inside root and rewrites its summary (the line, the word counts, the bar).
isShown(root: Element): boolean
setShown(root: HTMLElement, shown: boolean, persist?: boolean): voidShows or hides the marks: data-authorship on the container, the switch to match. With persist (the default, unless the container says data-remember="off") the choice is kept.
enhance(root?: ParentNode): () => voidAttaches to every [data-cap="authorship"] under root (or root itself) not yet attached: applies the remembered choice, wires the switch, and counts the summary. Returns a function that detaches them all.

CSS variables

VariableDefault
--cap-auth-gutter5.5rem
--cap-auth-padvar(--space-3)
--cap-auth-pad-blockvar(--space-4)
--cap-auth-rule4px
--cap-avatar-sizevar(--title-6)
--cap-run-colorvar(--accent)
--cap-run-patternsolid
--cap-share0

Parts and data attributes

ClassIs
.cap-authorshipthe root
.cap-authorship-bara part
.cap-authorship-sega part
.cap-authorship-summarya part
.cap-authorship-texta part
.cap-runits own class
.cap-run-labelits own class
AttributeValues
data-authorshipoff
data-kindai quoted
data-share0
StateRead from
:checkedthe platform

Accessibility

KeyDoes
TabMoves to the switch; the runs, labels and summary take no tab stop
Space on the switchShows or hides the authorship marks, at once
  • A label is text in the run, read where the run starts ("You", "AI", "Quoted"). Hidden, labels are not in the accessibility tree.
  • The rules are decoration for a screen reader and the identifying mark for a sighted person: 3:1 on the page, with a pattern.
  • The summary's bar is aria-hidden; its numbers are text. Label text, the summary and the notes reach 4.5:1.
  • An avatar in a label is aria-hidden, so the kind is not said twice.
  • Forced colors: the rules and bar segments are drawn in CanvasText, keeping their patterns; labels get a border.
  • Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.