• Stars
    star
    289
  • Rank 143,419 (Top 3 %)
  • Language
    HTML
  • License
    MIT License
  • Created about 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Annotate text and publish it on the web

Annotate

Annotate and publish text on the web! This project was created for "The (Edited) Latecomer's Guide to Crypto", but can be used to annotate any text document.

View a live demo at https://molly.github.io/annotate/.

How to use

Copy the index.html, styles.css, and annotate.js files to your project. You should only need to edit the index.html file, unless you want to change the styling or JavaScript behavior. This project does not require the JavaScript, so if you want to leave it out, just omit the annotate.js file and remove the <script src="./annotate.js"></script> tag from the HTML file. The screenshots folder has full-size screenshots of the index page in both desktop (index-desktop.png) and mobile (index-mobile.png) views, so you can see what the HTML produces.

Each section of the document follows this basic structure:

<section class="group">
  <div class="content quote">
    Text that's being <mark data-annotation-id="1" aria-details="unique-comment-id">annotated</mark>.
  </div>
  <div class="content note">
    <div class="annotation" role="comment" data-annotation-id="1" id="unique-comment-id">
      <div class="commenter">Commenter name</div>
      Comment text.
    </div>
  </div>
</section>

and produces:

Details

Each section of text is captured in a row with left- and right-hand sections. The <section class="group"> element represents this row. Each side then has a div with the content class and either the quote or note classes. quote is the text being annotated, note is for the annotations.

Each portion of highlighted text in the original source (left-hand side) is marked with <mark> tags. These must have a unique aria-details attribute that will correspond to the id of the annotation, which will enable visual focus highlighting on click. It can also optionally have a data-annotation-id to number the annotation, to help distinguish annotations when there are multiple in a section.

Corresponding to the <mark> tag will be a div with either the annotation or annotation-group class on the right-hand side (the former for single annotations, the latter for grouped annotations). These must have role="comment" and an id that exactly matches the unique aria-details value of the highlighted text to which it corresponds. As with the highlighted text, it can have a data-annotation-id to number the annotation.

Grouped annotations

Within an annotation group, there will be one or more divs with the annotation class. These can contain a div with the class commenter to identify the writer, if there are multiple annotators working on the document. These do not need role="comment, data-annotation-id, or id since they're nested within an annotation-group with those attributes.

In the case of multiple annotations within an annotation group, they can appear directly stacked, or threaded (rendering with increasing levels of indentation, to indicate that they are replies to one another). To thread comments, include the thread class on the second comment (the first reply). Any subsequent replies should be marked with the thread-x class, where x is the level of indentation from 2–10: thread-2, thread-3, ..., thread-10. Omit the thread classes to render multiple annotations in a stack without indentation.

<section class="group">
  <div class="content quote">
    Text that's being <mark data-annotation-id="1" aria-details="unique-comment-id">annotated</mark>.
  </div>
  <div class="content note">
    <div class="annotation-group" role="comment" data-annotation-id="1" id="unique-comment-id">
      <div class="annotation">
        A comment with indented responses.
      </div>
      <div class="annotation thread"> 
        A reply
      </div>
      <div class="annotation thread-2"> 
        A second reply
      </div>
    </div>
  </div>
</section>

Other source formats

The original Latecomer's Guide project was created using Pug and Sass. If you'd rather work with those, that source code lives over with my website source:

Mobile display

This is how the annotations display on mobile:

More Repositories

1

web3-is-going-great

A timeline of some of the greatest hits in cryptocurrencies, NFTs, and other web3 projects since the beginning of 2021
JavaScript
783
star
2

static-timeline-generator

Create static timeline webpages.
JavaScript
446
star
3

gh-dork

Github dorking tool
Python
136
star
4

manager-README

A crash course on what to expect if I'm your tech lead
123
star
5

twitterbot_framework

A very basic framework for creating Twitter bots.
Python
57
star
6

dynamic-website

Small app to power the dynamic portions of my website.
JavaScript
51
star
7

wikimedia-timeline

A timeline of events surrounding the Wikimedia Discovery project, senior leadership, staff departures, and other unrest at the Wikimedia Foundation from 2014–2016.
HTML
46
star
8

CyberPrefixer

Twitter bot to prefix "cyber" to news headlines
Python
43
star
9

w3igg-crossposter

Automate crossposting web3isgoinggreat.com posts to social media
Python
40
star
10

SOFT-HRUF

SOFT/HRUF free and open source steno hardware
37
star
11

GorillaBot

IRC bot framework written in Python.
Python
30
star
12

follow-the-crypto

Follow the cryptocurrency industry’s influence on 2024 elections in the United States.
TypeScript
28
star
13

courtlistener-download

Chrome extension to download all files related to one docket entry on CourtListener
JavaScript
23
star
14

website-v2

v2 of my personal website
Pug
20
star
15

blog

SCSS
17
star
16

follow-the-crypto-backend

Python
16
star
17

allmybotsgone

Python
16
star
18

misheardly

Twitter bot to mishear song lyrics
Python
13
star
19

ftx-contagion

Chart of the FTX contagion
12
star
20

yourevalued

Twitter bot to tell people they're valued.
Python
12
star
21

reading-list-extension

Chrome extension to add items to my reading lists
JavaScript
11
star
22

SubstitutionBot

Twitter bot to make funny news headlines a la http://xkcd.com/1288/.
Python
9
star
23

paywall-bot

A Bluesky bot to help people find unpaywalled resources.
Python
9
star
24

Wikisource-to-LaTeX

A Python project that traverses through a Wikisource project and compiles it into a LaTeX book.
Python
7
star
25

nft-theft-analysis

Python
6
star
26

easyreader

Custom JS/CSS to make Wikipedia pages more comfortable to read
CSS
6
star
27

snowbot

A Twitter bot that tells you the forecast for Boston, but more importantly tells you when that forecast changes.
Python
6
star
28

citation-needed-scripts

Scripts for CitationNeeded.news
JavaScript
6
star
29

absolute-dates

Chrome extension to show absolute dates where only relative dates are displayed
JavaScript
5
star
30

mass-shooting-map

Generate a map template of mass shootings in the United States for usage on Wikipedia.
Python
4
star
31

newsletter

HTML
3
star
32

wikipedia-covid-ma

Scripts to help update the Wikipedia article on the COVID pandemic in Massachusetts.
Python
3
star
33

delete-tweets

Script to delete tweets older than a specified date
Python
2
star
34

website

Code for my current website
HTML
2
star
35

citation-needed-backend

Small webhook server to augment a self-hosted Ghost site at CitationNeeded.news
JavaScript
2
star
36

ghost-patches

Patches to the Ghost core software, used for the Citation Needed newsletter
2
star
37

mbta-ui

Frontend for the MBTA transit app.
JavaScript
1
star
38

bias

JavaScript
1
star
39

audit-cuos

Generate activity reports for functionaries on the English Wikipedia.
Python
1
star
40

website-v3

v3 of my personal website
Nunjucks
1
star
41

convert-gmail-timestamp

Convert GMail timestamps to ISO 8601 timestamps
Python
1
star
42

brandeis

Parser to convert Mark Holmquist's lochner files to wikitext.
Python
1
star