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:

  1. Display an autocomplete component (or something similar) when users start typing a special key (e.g., "@") or press a button to include a mention.

  2. Upon identifying a mention (e.g., pubkey 27866e9d854c78ae625b867eefdfa9580434bc3e675be08d2acb526610d96fbe), the client must add the pubkey to the .tags with the tag p, 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:

  1. Perform a search-and-replace using the actual contents from the .tags array with the actual pubkey or event ID mentioned.

  2. 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