Goals: - [x] Can add global comments. - [ ] Can highlight part of the text (this can span multiple HTML element). - [ ] Can comment part of the text. What we could do: add a `data-annotation-id` tag to all fully tagged element and add relevant `div`s or `span`s to tag only what’s needed (or to prevent issues with breaking the HTML). That’s how notion and annotator do it! Relevant resources: * The [annotator](https://annotatorjs.org) project. Used by Wallabag. Doesn’t seem well maintained nowadays (last commit about 9 years ago). Does exactly what’s needed, not convinced by its format. And it’s not maintained any more. * [marker](https://github.com/robin-rpr/marker) an annotation extension for Firefox. It will create an image that must go above the text to handle the annotation. * There are API to wrap selection into an element. See https://stackoverflow.com/questions/24690357/add-tags-around-selected-text-in-an-element, https://stackoverflow.com/questions/6328718/how-to-wrap-surround-highlighted-text-with-an-element, https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents and https://developer.mozilla.org/en-US/docs/Web/API/Range The selection must not cross elements for this to work (ie selection across paragraphs). * If the selection wraps multiple element, we must wrap each part of the comment with the "span" that denotes the comment.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by Jenselme and has received 0 comments.