mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-01-09 15:51:33 +00:00
Merge pull request #1664 from nostr-protocol/p-tags-22
Add P-tags and p-tags to NIP-22
This commit is contained in:
commit
42370a3d30
33
22.md
33
22.md
@ -13,6 +13,9 @@ It uses `kind:1111` with plaintext `.content` (no HTML, Markdown, or other forma
|
||||
Comments MUST point to the root scope using uppercase tag names (e.g. `K`, `E`, `A` or `I`)
|
||||
and MUST point to the parent item with lowercase ones (e.g. `k`, `e`, `a` or `i`).
|
||||
|
||||
Comments MUST point to the authors when one is available (i.e. tagging a nostr event). `P` for the root scope
|
||||
and `p` for the author of the parent item.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
kind: 1111,
|
||||
@ -23,10 +26,16 @@ and MUST point to the parent item with lowercase ones (e.g. `k`, `e`, `a` or `i`
|
||||
// the root item kind
|
||||
["K", "<root kind>"],
|
||||
|
||||
// pubkey of the author of the root scope event
|
||||
["P", "<root-pubkey>", "relay-url-hint"],
|
||||
|
||||
// parent item: event addresses, event ids, or i-tags.
|
||||
["<a, e, i>", "<address, id or i-value>", "<relay or web page hint>", "<parent event's pubkey, if an e tag>"],
|
||||
// parent item kind
|
||||
["k", "<parent comment kind>"]
|
||||
["k", "<parent comment kind>"],
|
||||
|
||||
// parent item pubkey
|
||||
["p", "<parent-pubkey>", "relay-url-hint"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
@ -46,11 +55,6 @@ Their uppercase versions use the same type of values but relate to the root item
|
||||
```
|
||||
|
||||
`p` tags SHOULD be used when mentioning pubkeys in the `.content` with [NIP-21](21.md).
|
||||
If the parent item is an event, a `p` tag set to the parent event's author SHOULD be added.
|
||||
|
||||
```json
|
||||
["p", "<pubkey>", "<relay-url>"]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
@ -65,13 +69,17 @@ A comment on a blog post looks like this:
|
||||
["A", "30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
|
||||
// the root kind
|
||||
["K", "30023"],
|
||||
// author of root event
|
||||
["P", "3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289", "wss://example.relay"]
|
||||
|
||||
// the parent event address (same as root for top-level comments)
|
||||
["a", "30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
|
||||
// when the parent event is replaceable or addressable, also include an `e` tag referencing its id
|
||||
["e", "5b4fc7fed15672fefe65d2426f67197b71ccc82aa0cc8a9e94f683eb78e07651", "wss://example.relay"],
|
||||
// the parent event kind
|
||||
["k", "30023"]
|
||||
["k", "30023"],
|
||||
// author of the parent event
|
||||
["p", "3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289", "wss://example.relay"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
@ -88,11 +96,14 @@ A comment on a [NIP-94](94.md) file looks like this:
|
||||
["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
|
||||
// the root kind
|
||||
["K", "1063"],
|
||||
// author of the root event
|
||||
["P", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
|
||||
|
||||
// the parent event id (same as root for top-level comments)
|
||||
["e", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
|
||||
// the parent kind
|
||||
["k", "1063"]
|
||||
["k", "1063"],
|
||||
["p", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
@ -109,11 +120,13 @@ A reply to a comment looks like this:
|
||||
["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "fd913cd6fa9edb8405750cd02a8bbe16e158b8676c0e69fdc27436cc4a54cc9a"],
|
||||
// the root kind
|
||||
["K", "1063"],
|
||||
["P", "fd913cd6fa9edb8405750cd02a8bbe16e158b8676c0e69fdc27436cc4a54cc9a"],
|
||||
|
||||
// the parent event
|
||||
["e", "5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://example.relay", "93ef2ebaaf9554661f33e79949007900bbc535d239a4c801c33a4d67d3e7f546"],
|
||||
// the parent kind
|
||||
["k", "1111"]
|
||||
["k", "1111"],
|
||||
["p", "93ef2ebaaf9554661f33e79949007900bbc535d239a4c801c33a4d67d3e7f546"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
@ -178,7 +191,9 @@ A reply to a podcast comment:
|
||||
["e", "80c48d992a38f9c445b943a9c9f1010b396676013443765750431a9004bdac05", "wss://example.relay", "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111"],
|
||||
// the parent comment kind
|
||||
["k", "1111"]
|
||||
["p", "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111"]
|
||||
]
|
||||
// other fields
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user