# Annotation
Class
## About
`Annotation` is a discussion thread attached to a range of text or to a whole node. It never changes the document's content: it is stored beside the nodes in the document's JSON, and it is not part of HTML, Markdown, PDF, or printed output.
**Anchor.** `NodeID` is the annotated node. `CoversNode` is True for a whole node. Otherwise `Segment` is the text run, such as a table cell's index or 0 for a node with one run, and `Start` and `Length` are character offsets in it. `Quote` is the text the annotation was made on.
The editor keeps the anchor on its text as the document changes, whatever made the change: typing, pasting, formatting, undo, or a collaborator. Text inserted before the anchor moves it, text inserted inside it grows it, and deleted text shrinks it.
**Orphans.** An annotation is `Orphaned` when its text has all been deleted, leaving a `Length` of 0, or its node is no longer in the document. An orphaned annotation keeps its thread. It is shown as a marker on its node while the node exists, and covers its text again if the same text comes back where it was, as it does on undo. Undoing a node's deletion brings back the node and its annotations.
Read annotations from `Editor.Annotations`, and change them through it, so the editor redraws and raises `AnnotationAdded`, `AnnotationChanged`, and `AnnotationRemoved`.
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| CommentAt | index As Integer | Comment | Returns the comment at the supplied index in the thread, oldest first, or Nil. |
| Comments | (None) | Comment | Returns the thread's comments, oldest first. |
| LastCommentIndex | (None) | Integer | Returns the index of the thread's last comment, or -1 when it has none. |
| ToJSON | (None) | JSONItem | Returns the annotation, its anchor, and its comments as JSON. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Attributes | DrawnFrame | Rect | Gets or sets where the annotation was last drawn, in editor coordinates: its first line of text or its marker. Used by the editor to place the popover. |
| CoversNode | Boolean | (None) | Returns True when the annotation is attached to its whole node rather than to a range of text. |
| Created | DateTime | (None) | Returns when the thread's first comment was written. |
| ID | String | (None) | Returns the annotation's unique identifier. |
| Length | Integer | (None) | Returns the length of the annotated text in characters. It is 0 when the text has been deleted. |
| NodeID | String | (None) | Returns the NodeID of the annotated node. |
| Orphaned | Boolean | (None) | Returns True when the annotated text has been deleted or the annotated node is no longer in the document. |
| Quote | String | (None) | Returns the text the annotation was made on. |
| Resolved | Boolean | (None) | Returns whether the discussion has been resolved. |
| Segment | Integer | (None) | Returns the annotated text run: a table cell's index, or 0 for a node with one run of text. |
| Start | Integer | (None) | Returns the offset of the annotated text in its text run, in characters. |