{"id":"d556751c59d609787271e0fa92cd4513d7e39acd180fd8badb27fc1b23e8c6f6","pubkey":"dc4cd086cd7ce5b1832adf4fdd1211289880d2c7e295bcb0e684c01acee77c06","created_at":1782771980,"kind":30817,"tags":[["d","nostrdown"],["title","Nostrdown"],["alt","Nostr Implementation Possibility: Nostrdown"],["client","NostrHub"]],"content":"# Nostrdown   Inline Reference Syntax for Nostr\n\nNostrdown is a markup-agnostic inline syntax for referencing Nostr events from\nprose. It rides on top of whatever markup a document is written in. A `{{ }}`\ntoken names an event: it resolves to a coordinate, renders as a link / card /\nquote, and is emitted as a tag on the signed event.\n\n`{{ }}` is the reference delimiter because the pair is free across the common\nprose markups, so a reference never collides with the surrounding text   and a\nclient that does not parse the host markup can still find every reference by\nscanning for `{{ }}` alone. Markups keep their own links, images, and local-file\nreferences untouched; nostrdown only adds the one thing they cannot express:\npointers to Nostr data.\n\nA bare `nostr:` URI (NIP-21) is already a universal entity link, resolved by any\nclient. A `{{ }}` reference is the semantic layer over it   wrapping the same\ntarget to add a role and a tag: use `nostr:` to link anywhere, `{{ }}` when the\nreference should *do* something.\n\n## Grammar\n\n```abnf\nreference = \"{{\" prefix \":\" target [ \"|\" modifier ] \"}}\"\nmention   = \"{{@\" target [ \"|\" modifier ] \"}}\"   ; profile mention   target is an npub / nprofile (@name reserved)\nprefix    = \"ref\" / \"wiki\" / \"embed\" / \"quote\" / \"slot\" / \"cite\"\ntarget    = text     ; what is referenced\nmodifier  = text     ; a display label, render directive, or quote's excerpt\ntext      = any characters up to the next \"|\" or \"}}\"\n```\n\n`target` is the only required part after the prefix. Its admissible form   a\ntitle-slug, a NIP-19 entity (optionally `nostr:`-prefixed), or a\n`kind:pubkey:d-tag` coordinate   depends on the prefix (see *Prefixes*); the\ngrammar only locates where it ends.\n\nParsing rules:\n\n- Split on the *first* `:` only   colon-bearing targets (a coordinate, a\n  `nostr:` URI) are preserved intact.\n- `|` is optional and splits once; it runs to the closing `}}` as free text  \n  a display label, or `quote`'s inline excerpt.\n- A title-slug target is NIP-54 normalized (lowercased; spaces and separators\n  collapse to `-`; other punctuation dropped). Entities and coordinates are\n  matched verbatim.\n- A token with an unknown prefix or a malformed body is left as literal text.\n- `{{@target}}` is the mention shorthand   the `@` stands in for `prefix:`\n  (see *Prefixes*).\n\nTo reference one section of a publication, target that section directly   a\n30041 section is an addressable event with its own coordinate. There is no\nanchor-into-parent syntax; reference the child, not \"parent + child\".\n\n## `[[ ]]`   the wikilink alias\n\n`[[ ]]` is the established cross-tool wikilink and travels in published content\nregardless, so it is recognized   but *only* as a `wiki` reference, never as a\ngeneral Nostr pointer.\n\n```abnf\nwikilink = \"[[\" topic [ ( \"][\" / \"|\" ) display ] \"]]\"   ; topic, d-tag NIP-54 normalized\n```\n\n| form                 | meaning                      |\n| -------------------- | ---------------------------- |\n| `[[topic]]`          | wiki, label = topic          |\n| `[[d-tag][display]]` | wiki, bracketed display form |\n| `[[topic\\|display]]` | wiki, piped display form     |\n\nA target that is itself a link, scheme (`scheme:`, `://`), path, anchor, or\nimage / media file is left to the host markup and never claimed. Tag and\nresolution are identical to `{{wiki:topic}}`.\n\n## Prefixes\n\nEach prefix shares the grammar above and differs only in resolution and tag.\n\nA prefix names the reference's *role*   the human-facing vocabulary the author\nwrites. The *tag* it emits is the Nostr-native encoding, and need not share the\nprefix's name: a single-letter tag where one fits (`wiki`   `w`), otherwise the\ntag dictated by the target (an `embed` is `a` / `q` / `p` by entity type).\n`{{wiki:topic}}` and `[[topic]]` are two ways to write the one reference.\n\n| prefix  | example | resolves to | emitted tag |\n| ------- | ------- | ----------- | ----------- |\n| `ref`   | `{{ref:The Ascent}}` | a sibling section in the same publication | `[\"ref\", \"the-ascent\"]` |\n| `wiki`  | `{{wiki:proof of work}}` | kind 30818 (`d`), else 30040/41 (`T`), by title | `[\"w\", \"proof-of-work\"]` |\n| `embed` | `{{embed:naddr1 }}` | transclude the event inline, as a card | by target type (below) |\n| `quote` | `{{quote:naddr1  \\| And now, let me show in a figure }}` | attributed blockquote; the excerpt is inline, the target resolves for attribution only | `[\"a\", \"30041: pk : d \"]` `[\"p\", \" author \", \"\", \"author\"]` |\n| `slot`  | `{{slot:naddr1 }}` *(on its own line)* | the event becomes a child node of the index (addressable 30040 / 30041 only) | `[\"a\", \"30041: pk : d \"]` on the *30040 index* |\n| `cite`  | `{{cite:smith-2024}}` *(reserved)* | a kind-30161 citation record | `[\"cite\", \"smith-2024\", \"30161: pk :smith-2024\"]` |\n\n`embed` tag by target type   the same `{{embed: }}` token, tagged according to the target:\n\n| target          | example | emitted tag |\n| --------------- | ------- | ----------- |\n| naddr           | `{{embed:naddr1 }}`  | `[\"a\", \"30040: pk : d \", \" relay \"]` |\n| nevent / note   | `{{embed:nevent1 }}` | `[\"q\", \" id \", \" relay \", \" pubkey \"]` |\n| npub / nprofile | `{{embed:npub1 }}`   | `[\"p\", \" pubkey \", \" relay \"]` |\n\n`@` is the profile-mention shorthand   `{{@npub1 }}` (or `{{@nprofile1 }}`)\nrenders an inline `@handle` link rather than the full card `{{embed:npub1 }}`\ngives, and emits the same `p` tag. A mention is not kind-1-only; it carries into\nany event kind.\n\n| shorthand | example | emitted tag |\n| --------- | ------- | ----------- |\n| `{{@ }}`  | `{{@npub1 }}` / `{{@nprofile1 }}` | `[\"p\", \" pubkey \", \" relay \"]` |\n\n`embed` transcludes a whole event; `quote` carries an excerpt inline; `cite`\nreferences an excerpt held in a reusable record. `slot` is the only block-level\nprefix   inclusion by reference into the index tree, not the prose.\n\n`{{wiki:topic}}` involves two tags that point in opposite directions. Resolution\n*follows* **`d`**: the topic addresses its *definitional* event   the kind-30818\narticle (or a 30040 / 30041 section by its `T` title) whose `d`-tag is the\nnormalized topic. The citing event itself emits **`[\"w\", topic]`**   an *outgoing*\nusage marker recording that this event *uses* the term, carrying the topic only:\nauthor-agnostic, no pinned version, the way a wiki interlinks every page that\ninvokes a concept. Both are single-letter and relay-indexed: query the `d`-tag to\nreach what *defines* a term, the `w`-tag to find every event that *uses* it.\n\n## Examples\n\n```\n{{ref:The Ascent}}\n    inline link to the sibling section titled \"The Ascent\"\n{{ref:The Ascent|see above}}\n    the same link, shown as \"see above\"\n\n{{wiki:proof of work}}       [[proof of work]]\n    link to the wiki article on the topic (d-tag \"proof-of-work\")\n{{wiki:proof of work|PoW}}\n    the same link, shown as \"PoW\"\n\n{{embed:naddr1 }}\n    transclude a publication / section / article / wiki inline, as a card\n{{embed:nevent1 }}\n    quote-repost a note inline (NIP-18 `q` tag), as a card\n{{embed:npub1 }}\n    a profile card: name, picture, bio\n{{@npub1 }}       {{@nprofile1 }}\n    an inline @handle mention of the profile (not a card)\n\n{{quote:naddr1  | And now, let me show in a figure how far our\nnature is enlightened or unenlightened  }}\n    an attributed, collapsible blockquote; the excerpt is the inline text\n\n{{slot:naddr1 }}                                   (on its own line)\n    make that 30040 / 30041 a child node of the enclosing publication index\n\n{{cite:smith-2024}}                                (reserved)\n    a citation, rendered in the document's default style\n{{cite:smith-2024|foot}}\n    the same citation, forced to a footnote\n```\n\n## Presentation\n\nA reference declares *what*, not *how*. Render style (link, card, footnote,\nendnote, blockquote) is decided downstream, in order of precedence:\n\n1. a per-reference modifier (`{{cite:smith-2024|foot}}`);\n2. a publication-level tag on the 30040 index (`[\"citation-style\", \"chicago\"]`);\n3. reader preference.\n\n## Status\n\n- *Shipped*: `ref`, `wiki` (`{{ }}` and `[[ ]]`), `embed` (naddr / nevent /\n  note / npub / nprofile), `quote`, `slot`, `@` mention (npub / nprofile).\n- *Reserved*: `cite` (kind 30161), `book`, `@name` (mention by name).\n\n## Related\n\n- NKBIP-01 (30040 / 30041)\n- NKBIP-03 (`cite`; kind 30161)\n- NKBIP-08 (`book`)\n- NIP-19 (entities)\n- NIP-54 (wiki; normalization; kind 30818)\n- NIP-84 (highlights; the `quote` model)\n- NIP-18 (the `q` tag)\n- NIP-23 (kind 30023)","sig":"f87d1175ae6e5a35632ff546a82499b548842f71095aa922a4f7016e2984a95bfc6200eb192eede4fbd89ebaaecea054199a5ffd25af823f0d4db6a36493cab5"}