Embed annotation ID in <hypothesis-annotation> element?

16 views
Skip to first unread message

Jonny Saunders

unread,
Nov 27, 2021, 5:09:37 PM11/27/21
to dev
Hello! Got hopefully a simple one for you...

Currently annotations are embedded as:

<hypothesis-highlight class="hypothesis-highlight">
highlighted text
</hypothesis-highlight>

Annotations have unique IDs already, would it be possible to add that into the DOM element so that it could be linked to as an anchor (rather than linking to the annotation itself as from the "share" button)?

You could use a (configurable?) prefix to avoid collisions, eg. i think it might be nice to have something like

<hypothesis-highlight class="hypothesis-highlight" id="h:<ANNOTATION_ID>">
highlighted text
</hypothesis-highlight>

what do you think??

Jonny Saunders

unread,
Nov 27, 2021, 5:11:50 PM11/27/21
to dev, Jonny Saunders
while we're at it, it might be nice to also embed tag categories as classes so you could easily restyle the highlights for different classes, eg

<hypothesis-highlight class="hypothesis-highlight category:suggestion" ... >
highlighted text
</hypothesis-highlight>

so you could

.hypothesis-highlight.category:suggestion {
  ...

Robert Knight

unread,
Nov 28, 2021, 8:19:22 AM11/28/21
to Jonny Saunders, dev
For a page that embeds Hypothesis, you can add `#annotations:<ID>` to the URL and the client will respond to this by scrolling to the specified annotation. The annotation share link uses this but adds a layer on top that tries to use the best available mechanism to direct the user to the page with Hypothesis added.

A regular `id` attribute on the element won't work since the highlights are not present when the page initially loads, and thus the browser has nothing to scroll to.

Also as a general rule IDs and contents of annotations are not exposed to the page as a security restriction [1], although in the case of public annotations anyone can of course always fetch annotations given the page URL.

Kind regards,
Rob.

--
You received this message because you are subscribed to the Google Groups "dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@list.hypothes.is.
To view this discussion on the web visit https://groups.google.com/a/list.hypothes.is/d/msgid/dev/6ee52070-9e2d-40c8-bbaf-88e7cc4a17e6n%40list.hypothes.is.

Message has been deleted

Jonny Saunders

unread,
Dec 9, 2021, 5:58:16 PM12/9/21
to dev, Robert Knight, dev, Jonny Saunders
Aha, thanks for the perspective. Yes I forget about the generality of the tool and tend to think more in a tightly integrated with page kinda way. Thank you for letting me know about the #annotations anchor, that's really helpful and should be able to do what i need!

wystanbod graehme

unread,
Dec 12, 2021, 10:06:01 PM12/12/21
to Jonny Saunders, dev, Robert Knight

Hi Rob,

 

Many thanks for your email.  But I thought that maybe you send the wrong email address.

 

So do you have any translation and annotation services needs recently?

We have professional service with good price and we can deliver on time.

 

I'm really looking forward to your early reply.

 

Warm Regards,

 

Natalie


Reply all
Reply to author
Forward
0 new messages