NIP-54: Fix d-tag normalization for non-Latin scripts (#2177)

This commit is contained in:
Vincenzo Imperati
2025-12-27 18:04:08 +01:00
committed by GitHub
parent f5a15ea27e
commit fa9281af8b

30
54.md
View File

@@ -8,7 +8,7 @@ Wiki
This NIP defines `kind:30818` (an _addressable event_) for descriptions (or encyclopedia entries) of particular subjects, and it's expected that multiple people will write articles about the exact same subjects, with either small variations or completely independent content. This NIP defines `kind:30818` (an _addressable event_) for descriptions (or encyclopedia entries) of particular subjects, and it's expected that multiple people will write articles about the exact same subjects, with either small variations or completely independent content.
Articles are identified by lowercase, normalized ascii `d` tags. Articles are identified by lowercase, normalized `d` tags.
## Articles ## Articles
```json ```json
@@ -16,15 +16,30 @@ Articles are identified by lowercase, normalized ascii `d` tags.
"content": "A wiki is a hypertext publication collaboratively edited and managed by its own audience.", "content": "A wiki is a hypertext publication collaboratively edited and managed by its own audience.",
"tags": [ "tags": [
["d", "wiki"], ["d", "wiki"],
["title", "Wiki"], ["title", "Wiki"]
] ]
} }
``` ```
## `d` tag normalization rules ## `d` tag normalization rules
- Any non-letter character MUST be converted to a `-`. - All letters with uppercase/lowercase variants MUST be converted to lowercase.
- All letters MUST be converted to lowercase. - Whitespace MUST be converted to `-`.
- Punctuation and symbols SHOULD be removed.
- Multiple consecutive `-` SHOULD be collapsed to a single `-`.
- Leading and trailing `-` SHOULD be removed.
- Non-ASCII letters (e.g., Japanese, Chinese, Arabic, Cyrillic) MUST be preserved as UTF-8.
- Numbers MUST be preserved.
For example:
- `"Wiki Article"``"wiki-article"`
- `"What's Up?"``"whats-up"`
- `" Hello World "``"hello-world"`
- `"Article 1"``"article-1"`
- `"ウィキペディア"``"ウィキペディア"` (Japanese, no case change)
- `"Ñoño"``"ñoño"` (Spanish, lowercased)
- `"Москва"``"москва"` (Russian, lowercased)
- `"日本語 Article"``"日本語-article"` (mixed scripts)
## Content ## Content
@@ -32,10 +47,11 @@ The `content` should be Asciidoc with two extra functionalities: **wikilinks** a
Unlike normal Asciidoc links `http://example.com[]` that link to external webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink. Unlike normal Asciidoc links `http://example.com[]` that link to external webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink.
Wikilinks can take these two forms: Wikilinks can take these forms:
1. `[[Target Page]]` -- in this case it will link to the page `target-page` (according to `d` tag normalization rules above) and be displayed as `Target Page`; 1. `[[Target Page]]` -- links to `target-page` and displays as `Target Page`;
2. `[[target page|see this]]` -- in this case it will link to the page `target-page`, but will be displayed as `see this`. 2. `[[target page|see this]]` -- links to `target-page` but displays as `see this`;
3. `[[日本語 Topic|Japanese Topic]]` -- links to `日本語-topic` and displays as `Japanese Topic`.
`nostr:...` links, as per [NIP-21](21.md), should link to profiles or arbitrary Nostr events. Although it is not recommended to link to specific versions of articles -- instead the _wikilink_ syntax should be preferred, since it should be left to the reader and their client to decide what version of any given article they want to read. `nostr:...` links, as per [NIP-21](21.md), should link to profiles or arbitrary Nostr events. Although it is not recommended to link to specific versions of articles -- instead the _wikilink_ syntax should be preferred, since it should be left to the reader and their client to decide what version of any given article they want to read.