nips/23.md

69 lines
3.7 KiB
Markdown
Raw Normal View History

2023-02-03 18:59:07 +00:00
NIP-23
======
Long-form Content
-----------------
`draft` `optional` `author:fiatjaf`
This NIP defines `kind:30023` (a parameterized replaceable event according to NIP-33) for long-form text content, generally referred to as "articles" or "blog posts".
"Social" clients that deal primarily with `kind:1` notes should not be expected to implement this NIP.
### Format
The `.content` of these events should be a string text in Markdown syntax, including YAML front-matter for other metadata that may be necessary.
### Metadata
This NIP defines only `title` as the metadata. For the date of publication the event `.created_at` field should be used, and for "tags"/"hashtags" (i.e. topics about which the event might be of relevance) the `"t"` event tag should be used, as in NIP-12.
### Editability
These articles are meant to be editable, so they should make use of the replaceability feature of NIP-33 and include a `"d"` tag with an identifier for the article. Clients should take care to only publish and read these events from relays that implement that. If they don't do that they should also take care to hide old versions of the same article they may receive.
### Linking
The article may be linked to using the NIP-19 `nitem` code along with the `"i"` tag (see NIP-33 and NIP-19).
2023-02-03 18:59:07 +00:00
### References
Writing clients should implement support for parsing pasted NIP-19 `nitem` 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 -- or, if the reference is in the form of a URL (for example, `[click here](nitem1...)`) 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]`).
2023-02-03 18:59:07 +00:00
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 `nostr:nitem1...` links or direct links to web clients that will handle these references.
2023-02-03 18:59:07 +00:00
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...`.
2023-02-03 18:59:07 +00:00
## Example of an event
Article text:
```markdown
title: Lorem Ipsum
---
Lorem [ipsum][3] 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.
2023-02-03 18:59:07 +00:00
Read more at #[2].
2023-02-03 18:59:07 +00:00
```
Derived event:
```json
{
"kind": 30023,
"created_at": 1000000000,
"title": "Lorem Ipsum\\n---\\n\\nLorem [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].",
"tags": [
["d", "lorem-ipsum"],
["t", "plceholder"],
2023-02-03 18:59:07 +00:00
["e", "b3e392b11f5d4f28321cedd09303a748acfd0487aea5a7450b3481c60b6e4f87", "wss://relay.example.com"],
["i", "30023:a695f6b60119d9521934a691347d9f78e8770b56da16bb255ee286ddf9fda919:ipsum", "wss://relay.nostr.org"]
2023-02-03 18:59:07 +00:00
],
"pubkey": "...",
"id": "..."
}
```