NIP-8
NIP-08 provides a standard for handling mentions within Nostr text_notes, including the process of identifying mentions, adding them to tags, and displaying them with appropriate context augmentation.
NIP-08 standardizes the treatment of inline mentions of other events and pubkeys within the content of text_notes for Nostr clients. To implement tagged mentions, clients must:
Display an autocomplete component (or something similar) when users start typing a special key (e.g., "@") or press a button to include a mention.
Upon identifying a mention (e.g., pubkey
27866e9d854c78ae625b867eefdfa9580434bc3e675be08d2acb526610d96fbe
), the client must add the pubkey to the.tags
with the tagp
, and replace its textual reference in.content
with#[index]
, where "index" is the 0-based index of the related tag in the tags array.
The same process applies to mentioning event IDs.
When a client receives a text_note
event with such #[index]
mentions in its .content
, it can:
Perform a search-and-replace using the actual contents from the
.tags
array with the actual pubkey or event ID mentioned.Implement any desired context augmentation (e.g., linking to the pubkey or showing a preview of the mentioned event contents).
If #[index]
has an index outside the range of the tags array or points to a tag that is not an e
or p
tag (or a tag otherwise declared to support this notation), the client must not perform the replacement or augmentation and display it as normal text.
Last updated