Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: jupytercad/JupyterCAD#126
Creates a generic interface for annotations and adds annotations to the notebook's cells.
Description
The model I'm using for the annotations is based on the recommendations exposed in the W3C. An example of a notebook comment could be the following:
Attributes description
@context
Points to the definition of the schema used for the annotation
motivation
andpurpose
It is used to indicate the type of the annotation or body. We can use
commenting
to add comments threads andediting
to add a change request.created
andcreator
Identifies who created the annotation or body and when.
body
The body represents a resource that a user added to the annotation. For example, it can be a simple text comment or an audio, video, or image attachment. In this case, the
body
is a list of bodies to create a thread of comments or suggestions mixed with comments.When the
purpose
of a body is tagged asediting
, it is a change suggestion and can be applied to the document on the target position.target
The
target
represents the position on the document where the annotation is pointing to.Regarding the
target
, each document will have a different type selector. For the notebook, there are two possibilities. The above example assumes we store the annotation in the notebook's metadata (it also allows us to keep it outside the document, for example, a DB) and includes the path of the notebook, the cell, and the position of the selection in the text. Another possibility would be to use a simple TextQuoteSelector and store the annotation in the metadata of the cell.Other attributes that we can use
generator
To indicate what client created the annotation. Moreover, this is optional for now since only jupyterlab will support annotations. See the example of the
generator
attribute: