From fa9281af8b7c964542dd1145ba61a9fd851af713 Mon Sep 17 00:00:00 2001 From: Vincenzo Imperati <61617279+VincenzoImp@users.noreply.github.com> Date: Sat, 27 Dec 2025 18:04:08 +0100 Subject: [PATCH] NIP-54: Fix d-tag normalization for non-Latin scripts (#2177) --- 54.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/54.md b/54.md index b23e8bd9..59c49b30 100644 --- a/54.md +++ b/54.md @@ -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. -Articles are identified by lowercase, normalized ascii `d` tags. +Articles are identified by lowercase, normalized `d` tags. ## Articles ```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.", "tags": [ ["d", "wiki"], - ["title", "Wiki"], + ["title", "Wiki"] ] } ``` ## `d` tag normalization rules -- Any non-letter character MUST be converted to a `-`. -- All letters MUST be converted to lowercase. +- All letters with uppercase/lowercase variants 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 @@ -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. -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`; - 2. `[[target page|see this]]` -- in this case it will link to the page `target-page`, but will be displayed as `see this`. + 1. `[[Target Page]]` -- links to `target-page` and displays as `Target Page`; + 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.