gamburg / margin

Lightweight markup designed for an open mind
https://margin.love
MIT License
190 stars 9 forks source link

Store annotations as objects #18

Open gamburg opened 4 years ago

gamburg commented 4 years ago

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" }]
mtsknn commented 4 years ago

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`