upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/84.md
diff options
context:
space:
mode:
authorPablo Fernandez <p@f7z.io>2023-11-07 14:16:43 +0200
committerGitHub <noreply@github.com>2023-11-07 09:16:43 -0300
commitb128ad98ade41b2b1f029e7460329554748fea73 (patch)
tree2889d6c9e5ac048141527fd5292bf7e92da27e8d /84.md
parent108b7f16f9f75157cffde590a55077e4dfe7c955 (diff)
NIP-84: Highlights (#501)
Co-authored-by: Alejandro <alejandro@strike.me> Co-authored-by: arthurfranca <arthur.a.franca@gmail.com> Co-authored-by: fiatjaf_ <fiatjaf@gmail.com>
Diffstat (limited to '84.md')
-rw-r--r--84.md98
1 files changed, 98 insertions, 0 deletions
diff --git a/84.md b/84.md
new file mode 100644
index 0000000..b4a4be7
--- /dev/null
+++ b/84.md
@@ -0,0 +1,98 @@
1NIP-84
2======
3
4Highlights
5----------
6
7`draft` `optional` `author:pablof7z`
8
9This NIP defines `kind:9802`, a "highlight" event, to signal content a user finds valuable.
10
11## Format
12The `.content` of these events is the highlighted portion of the text.
13
14`.content` might be empty for highlights of non-text based media (e.g. NIP-94 audio/video).
15
16### References
17Events SHOULD tag the source of the highlight, whether nostr-native or not.
18`a` or `e` tags should be used for nostr events and `r` tags for URLs.
19
20When tagging a URL, clients generating these events SHOULD do a best effort of cleaning the URL from trackers
21or obvious non-useful information from the query string.
22
23### Attribution
24Clients MAY include one or more `p` tags, tagging the original authors of the material being highlighted; this is particularly
25useful when highlighting non-nostr content for which the client might be able to get a nostr pubkey somehow
26(e.g. prompting the user or reading a `<meta name="nostr:nprofile1..." />` tag on the document). A role MAY be included as the
27last value of the tag.
28
29```json
30[ "p", "...", "author" ],
31[ "p", "...", "author" ],
32[ "p", "...", "editor" ],
33```
34
35### Context
36Clients MAY include a `context` tag, useful when the highlight is a subset of a paragraph and displaying the
37surrounding content might be beneficial to give context to the higlight.
38
39### Ranges
40Clients MAY include `range` tags with the start/end indexes of where the highlight begins and finishes within
41the referenced article/tagged-event.
42
43```
44[ "range", <start-index>, <end-index> ]
45```
46
47Additionally a range with `context` as the third value of the tag MAY be added to indicate the begin/finish indexes
48of the highlight within the included `context` tag.
49
50```
51[ "range", <start-index>, <end-index>, "context" ]
52```
53
54#### Text-based nostr events' highlights
55
56Highlights of Nostr events SHOULD use the range index of the content as-is
57(e.g. NIP-23 articles include the markdown instead of computing the index from the rendered markdown).
58
59```
60[ "range", 3000, 3042 ] # highlight begins at index position 3000 of the tagged event's `.content`
61[ "range", 42, 84, "context" ] # highlight begins at index position 42 of the `context` tag's value
62```
63
64#### Non-text-based nostr events' highlights
65
66A `kind:9802` event that tags a NIP-94 event which includes a video or audio file can use ranges to
67indicate the start/end time position in seconds.
68
69#### Ranges in URL highlights
70
71When creating a highlight from a URL the range should be expressed over
72the extracted plain text of the formatted content (e.g. rendered HTML instead of including the HTML markup);
73this helps make finding the correct indexes easier on websites with markup variations on each render.
74
75e.g. `<html><body>hello, world</body></html>`
76
77Tagging `hello, world` would result in using a range tag like `["range", 0, 12 ]`.
78
79Text extraction (i.e. translation from non-plain text medium like HTML or PDF) is highly subjective and the value
80of the range should be carefully interpreted by the different clients that support this.
81
82```json
83{
84 "created_at": 1682707885,
85 "content": "while allowing creators to simply keep doing what they’re doing. Creators don’t need to be blatant shills for brands",
86 "tags": [
87 [ "r", "https://footstr.com/zapvertise/" ],
88 [ "p", "c48e29f04b482cc01ca1f9ef8c86ef8318c059e0e9353235162f080f26e14c11", "wss://relay.url", "author" ],
89 [ "context", "The Nostr zapvertising model creates a truly free market for advertisers, while allowing creators to simply keep doing what they’re doing. Creators don’t need to be blatant shills for brands, they just have to create high quality content people find valuable, and companies will naturally want to zapvertise on their posts." ]
90 [ "range", 3916, 4032 ],
91 [ "range", 74, 190, "context" ],
92 ],
93 "kind": 9802,
94 "pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
95 "id": "59e5887a3cdf32d5f11edf9b8cd098c620d278514b2edde3e6d1ba8a541d262c",
96 "sig": "f2d15b8bc2csf6d198350f8df0a31dcf66d7c32ec9c54e6b3f102d579370b7de9d164d70350a5b32a2911db3b124e972bafa9a1bc8fd60c1e338903d2f6306b0"
97}
98```