margin icon indicating copy to clipboard operation
margin copied to clipboard

Store annotations as objects

Open gamburg opened this issue 4 years ago • 1 comments

Originally raised by @mtsknn in https://github.com/gamburg/margin/issues/11#issuecomment-627576288

As @burlesona put it:

Item 1 [a note]
Item 2 [tag: foo]
Item 3
  [tag: red]
  [tag: blue]

In JSON these annotations would come out as:

// Item 1 Annotations:
[{ "value": "a note" }]

// Item 2 Annotations:
[{ "index": "tag", "value": "foo" }]

// Item 3 Annotations
[{ "index": "tag", "value": "red" }, { "index": "tag", "value": "blue" }]

gamburg avatar May 18 '20 22:05 gamburg

And index could instead be called type or key. The current documentation uses the term type, and there's a separate section called "Indexes":

An index is any item that parents an annotation of type `filter`

mtsknn avatar May 19 '20 05:05 mtsknn