Skip to content

dokieli/web-annotation

Repository files navigation

dokieli Web Annotation

W3C Web Annotation implementation for creating, parsing, and serializing Web Annotations in JSON-LD, with support for HTML+RDFa embedding and DOM-based annotation application.

License

Installation

npm install @dokieli/web-annotation

or

yarn install @dokieli/web-annotation
import { createAnnotation, serializeAnnotationToJSONLD, serializeAnnotationToHTML } from '@dokieli/web-annotation';

const annotation = createAnnotation({
  motivatedBy: 'oa:commenting',
  body: { value: 'A note.' },
  target: { source: 'https://example.org/', selector: { type: 'TextQuoteSelector', exact: 'annotated text' } }
});

const jsonld = serializeAnnotationToJSONLD(annotation);
const html = serializeAnnotationToHTML(annotation);

Documentation

See API Reference and Examples.

Features

  • Parsing and serializing annotations in JSON-LD and HTML+RDFa.
  • Support for selectors and states.
  • Restoring the selection object from a stored selector.
  • Marking the annotated text (the target) in the DOM.

Specifications

Conformance

The data in JSON-LD this library emits conforms to the W3C Web Annotation Data Model, validated against the official w3c/web-annotation-tests suite (its MUST assertions). Run the checks with yarn test:conformance.

Contributing

See the Contributing Guide for development setup, tests, and commit conventions.

Supported By

Support the project

Help the project grow by sponsoring it on Open Collective or reach out to us.

About

W3C Web Annotation implementation for creating, parsing, and serializing Web Annotations in JSON-LD, with support for HTML+RDFa embedding and DOM-based annotation application.

Topics

Resources

License

Contributing

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors