Merge branch 'master' into master

This commit is contained in:
fiatjaf_ 2023-03-26 07:19:39 -03:00 committed by GitHub
commit 8c46cdd1a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 10 deletions

4
08.md
View File

@ -1,10 +1,12 @@
> __Warning__ `unrecommended`: deprecated in favor of NIP-27
NIP-08 NIP-08
====== ======
Handling Mentions Handling Mentions
----------------- -----------------
`final` `optional` `author:fiatjaf` `author:scsibug` `depends:01` `final` `unrecommended` `optional` `author:fiatjaf` `author:scsibug` `depends:01`
This document standardizes the treatment given by clients of inline mentions of other events and pubkeys inside the content of `text_note`s. This document standardizes the treatment given by clients of inline mentions of other events and pubkeys inside the content of `text_note`s.

10
23.md
View File

@ -35,13 +35,7 @@ The article may be linked to using the [NIP-19](19.md) `naddr` code along with t
### References ### References
Clients that support publishing `NIP-23` events should implement support for parsing pasted [NIP-19](19.md) `naddr` identifiers and adding them automatically to the list of `.tags` of the event, replacing the actual content with a string like `#[tag_index]` in the same way as [NIP-08](08.md) -- or, if the reference is in the form of a URL (for example, `[click here](naddr1...)`) then they should be replaced with just the tag number directly as if link with that name existed at the bottom of the Markdown (for example, `[click here][0]`). References to other Nostr notes, articles or profiles must be made according to [NIP-27](27.md), i.e. by using [NIP-21](21.md) `nostr:...` links and optionally adding tags for these (see example below).
Reader clients should parse the Markdown and replace these references with either internal links so the referenced events can be accessed directly, with [NIP-21](21.md) `nostr:naddr1...` links or direct links to web clients that will handle these references.
The idea here is that having these tags is that reader clients can display a list of backreferences at the bottom when one article mentions another.
The same principles can be applied to `nevent1...`, `note1...`, `nprofile1...` or `npub1...`.
## Example Event ## Example Event
@ -49,7 +43,7 @@ The same principles can be applied to `nevent1...`, `note1...`, `nprofile1...` o
{ {
"kind": 30023, "kind": 30023,
"created_at": 1675642635, "created_at": 1675642635,
"content": "Lorem [ipsum][4] dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\nRead more at #[3].", "content": "Lorem [ipsum][nostr:nevent1qqst8cujky046negxgwwm5ynqwn53t8aqjr6afd8g59nfqwxpdhylpcpzamhxue69uhhyetvv9ujuetcv9khqmr99e3k7mg8arnc9] dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\nRead more at nostr:naddr1qqzkjurnw4ksz9thwden5te0wfjkccte9ehx7um5wghx7un8qgs2d90kkcq3nk2jry62dyf50k0h36rhpdtd594my40w9pkal876jxgrqsqqqa28pccpzu.",
"tags": [ "tags": [
["d", "lorem-ipsum"], ["d", "lorem-ipsum"],
["title", "Lorem Ipsum"], ["title", "Lorem Ipsum"],

54
27.md Normal file
View File

@ -0,0 +1,54 @@
NIP-27
======
Text Note References
--------------------
`draft` `optional` `author:arthurfranca` `author:hodlbod` `author:fiatjaf`
This document standardizes the treatment given by clients of inline references of other events and profiles inside the `.content` of any event that has readable text in its `.content` (such as kinds 1 and 30023).
When creating an event, clients should include mentions to other profiles and to other events in the middle of the `.content` using NIP-21 codes, such as `nostr:nprofile1qqsw3dy8cpu...6x2argwghx6egsqstvg`.
Including [NIP-10](10.md)-style tags (`["e", <hex-id>, <relay-url>, <marker>]`) for each reference is optional, clients should do it whenever they want the profile being mentioned to be notified of the mention, or when they want the referenced event to recognize their mention as a reply.
A reader client that receives an event with such `nostr:...` mentions in its `.content` can do any desired context augmentation (for example, linking to the profile or showing a preview of the mentioned event contents) it wants in the process. If turning such mentions into links, they could become internal links, NIP-21 links or direct links to web clients that will handle these references.
---
## Example of a profile mention process
Suppose a Bob is writing a note in a client that has search-and-autocomplete functionality for users that is triggered when they write the character `@`.
As Bob types `"hello @mat"` the client will prompt him to autocomplete with [mattn's profile](https://gateway.nostr.com/p/2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc), showing a picture and name.
Bob presses "enter" and now he sees his typed note as `"hello @mattn"`, `@mattn` is highlighted, indicating that it is a mention. Internally, however, the event looks like this:
```json
{
"content": "hello nostr:nprofile1qqszclxx9f5haga8sfjjrulaxncvkfekj097t6f3pu65f86rvg49ehqj6f9dh",
"created_at": 1679790774,
"id": "f39e9b451a73d62abc5016cffdd294b1a904e2f34536a208874fe5e22bbd47cf",
"kind": 1,
"pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"sig": "f8c8bab1b90cc3d2ae1ad999e6af8af449ad8bb4edf64807386493163e29162b5852a796a8f474d6b1001cddbaac0de4392838574f5366f03cc94cf5dfb43f4d",
"tags": [
[
"e",
"2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc"
]
]
}
```
(Alternatively, the mention could have been a `nostr:npub1...` URL.)
After Bob publishes this event and Carol sees it, her client will initially display the `.content` as it is, but later it will parse the `.content` and see that there is a `nostr:` URL in there, decode it, extract the public key from it (and possibly relay hints), fetch that profile from its internal database or relays, then replace the full URL with the name `@mattn`, with a link to the internal page view for that profile.
## Verbose and probably unnecessary considerations
- The example above was very concrete, but it doesn't mean all clients have to implement the same flow. There could be clients that do not support autocomplete at all, so they just allow users to paste raw [NIP-19](19.md) codes into the body of text, then prefix these with `nostr:` before publishing the event.
- The flow for referencing other events is similar: a user could paste a `note1...` or `nevent1...` code and the client will turn that into a `nostr:note1...` or `nostr:nevent1...` URL. Then upon reading such references the client may show the referenced note in a preview box or something like that -- or nothing at all.
- Other display procedures can be employed: for example, if a client that is designed for dealing with only `kind:1` text notes sees, for example, a [`kind:30023`](23.md) `nostr:naddr1...` URL reference in the `.content`, it can, for example, decide to turn that into a link to some hardcoded webapp capable of displaying such events.
- Clients may give the user the option to include or not include tags for mentioned events or profiles. If someone wants to mention `mattn` without notifying them, but still have a nice augmentable/clickable link to their profile inside their note, they can instruct their client to _not_ create a `["p", ...]` tag for that specific mention.
- In the same way, if someone wants to reference another note but their reference is not meant to show up along other replies to that same note, their client can choose to not include a corresponding `["e", ...]` tag for any given `nostr:nevent1...` URL inside `.content`. Clients may decide to expose these advanced functionalities to users or be more opinionated about things.

View File

@ -9,7 +9,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
- [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](05.md) - [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](05.md)
- [NIP-06: Basic key derivation from mnemonic seed phrase](06.md) - [NIP-06: Basic key derivation from mnemonic seed phrase](06.md)
- [NIP-07: `window.nostr` capability for web browsers](07.md) - [NIP-07: `window.nostr` capability for web browsers](07.md)
- [NIP-08: Handling Mentions](08.md) - [NIP-08: Handling Mentions](08.md) `unrecommended`: deprecated in favor of [NIP-27](27.md)
- [NIP-09: Event Deletion](09.md) - [NIP-09: Event Deletion](09.md)
- [NIP-10: Conventions for clients' use of `e` and `p` tags in text events](10.md) - [NIP-10: Conventions for clients' use of `e` and `p` tags in text events](10.md)
- [NIP-11: Relay Information Document](11.md) - [NIP-11: Relay Information Document](11.md)
@ -25,6 +25,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
- [NIP-23: Long-form Content](23.md) - [NIP-23: Long-form Content](23.md)
- [NIP-25: Reactions](25.md) - [NIP-25: Reactions](25.md)
- [NIP-26: Delegated Event Signing](26.md) - [NIP-26: Delegated Event Signing](26.md)
- [NIP-27: Text Note References](27.md)
- [NIP-28: Public Chat](28.md) - [NIP-28: Public Chat](28.md)
- [NIP-33: Parameterized Replaceable Events](33.md) - [NIP-33: Parameterized Replaceable Events](33.md)
- [NIP-36: Sensitive Content](36.md) - [NIP-36: Sensitive Content](36.md)