diff --git a/84.md b/84.md new file mode 100644 index 00000000..b4a4be72 --- /dev/null +++ b/84.md @@ -0,0 +1,98 @@ +NIP-84 +====== + +Highlights +---------- + +`draft` `optional` `author:pablof7z` + +This NIP defines `kind:9802`, a "highlight" event, to signal content a user finds valuable. + +## Format +The `.content` of these events is the highlighted portion of the text. + +`.content` might be empty for highlights of non-text based media (e.g. NIP-94 audio/video). + +### References +Events SHOULD tag the source of the highlight, whether nostr-native or not. +`a` or `e` tags should be used for nostr events and `r` tags for URLs. + +When tagging a URL, clients generating these events SHOULD do a best effort of cleaning the URL from trackers +or obvious non-useful information from the query string. + +### Attribution +Clients MAY include one or more `p` tags, tagging the original authors of the material being highlighted; this is particularly +useful when highlighting non-nostr content for which the client might be able to get a nostr pubkey somehow +(e.g. prompting the user or reading a `` tag on the document). A role MAY be included as the +last value of the tag. + +```json +[ "p", "...", "author" ], +[ "p", "...", "author" ], +[ "p", "...", "editor" ], +``` + +### Context +Clients MAY include a `context` tag, useful when the highlight is a subset of a paragraph and displaying the +surrounding content might be beneficial to give context to the higlight. + +### Ranges +Clients MAY include `range` tags with the start/end indexes of where the highlight begins and finishes within +the referenced article/tagged-event. + +``` +[ "range", , ] +``` + +Additionally a range with `context` as the third value of the tag MAY be added to indicate the begin/finish indexes +of the highlight within the included `context` tag. + +``` +[ "range", , , "context" ] +``` + +#### Text-based nostr events' highlights + +Highlights of Nostr events SHOULD use the range index of the content as-is +(e.g. NIP-23 articles include the markdown instead of computing the index from the rendered markdown). + +``` +[ "range", 3000, 3042 ] # highlight begins at index position 3000 of the tagged event's `.content` +[ "range", 42, 84, "context" ] # highlight begins at index position 42 of the `context` tag's value +``` + +#### Non-text-based nostr events' highlights + +A `kind:9802` event that tags a NIP-94 event which includes a video or audio file can use ranges to +indicate the start/end time position in seconds. + +#### Ranges in URL highlights + +When creating a highlight from a URL the range should be expressed over +the extracted plain text of the formatted content (e.g. rendered HTML instead of including the HTML markup); +this helps make finding the correct indexes easier on websites with markup variations on each render. + +e.g. `hello, world` + +Tagging `hello, world` would result in using a range tag like `["range", 0, 12 ]`. + +Text extraction (i.e. translation from non-plain text medium like HTML or PDF) is highly subjective and the value +of the range should be carefully interpreted by the different clients that support this. + +```json +{ + "created_at": 1682707885, + "content": "while allowing creators to simply keep doing what they’re doing. Creators don’t need to be blatant shills for brands", + "tags": [ + [ "r", "https://footstr.com/zapvertise/" ], + [ "p", "c48e29f04b482cc01ca1f9ef8c86ef8318c059e0e9353235162f080f26e14c11", "wss://relay.url", "author" ], + [ "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." ] + [ "range", 3916, 4032 ], + [ "range", 74, 190, "context" ], + ], + "kind": 9802, + "pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", + "id": "59e5887a3cdf32d5f11edf9b8cd098c620d278514b2edde3e6d1ba8a541d262c", + "sig": "f2d15b8bc2csf6d198350f8df0a31dcf66d7c32ec9c54e6b3f102d579370b7de9d164d70350a5b32a2911db3b124e972bafa9a1bc8fd60c1e338903d2f6306b0" +} +``` diff --git a/README.md b/README.md index 8be05951..f818b043 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos - [NIP-72: Moderated Communities](72.md) - [NIP-75: Zap Goals](75.md) - [NIP-78: Application-specific data](78.md) +- [NIP-84: Highlights](84.md) - [NIP-89: Recommended Application Handlers](89.md) - [NIP-90: Data Vending Machines](90.md) - [NIP-94: File Metadata](94.md) @@ -101,6 +102,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos | `9041` | Zap Goal | [75](75.md) | | `9734` | Zap Request | [57](57.md) | | `9735` | Zap | [57](57.md) | +| `9802` | Highlights | [84](84.md) | | `10000` | Mute List | [51](51.md) | | `10001` | Pin List | [51](51.md) | | `10002` | Relay List Metadata | [65](65.md) |