From f90101406592134e5f9c27c5e81fad3ee670e9c1 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 29 Mar 2025 16:29:58 -0300 Subject: rename 95 to C0. --- 95.md | 65 ----------------------------------------------------------------- C0.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 95.md create mode 100644 C0.md diff --git a/95.md b/95.md deleted file mode 100644 index 3dd7f26..0000000 --- a/95.md +++ /dev/null @@ -1,65 +0,0 @@ -# NIP-95: Code Snippets - -`draft` `optional` - -## Abstract - -This NIP defines a new event kind for sharing and storing code snippets. Unlike regular text notes (`kind:1`), code snippets have specialized metadata like language, extension, and other code-specific attributes that enhance discoverability, syntax highlighting, and improved user experience. - -## Event Kind - -This NIP defines `kind:1337` as a code snippet event. - -The `.content` field contains the actual code snippet text. - -## Optional Tags - -- `l` - Programming language name (lowercase). Examples: "javascript", "python", "rust" -- `name` - Name of the code snippet, commonly a filename. Examples: "hello-world.js", "quick-sort.py" -- `extension` - File extension (without the dot). Examples: "js", "py", "rs" -- `description` - Brief description of what the code does -- `runtime` - Runtime or environment specification (e.g., "node v18.15.0", "python 3.11") -- `license` - License under which the code is shared (e.g., "MIT", "GPL-3.0", "Apache-2.0") -- `dep` - Dependency required for the code to run (can be repeated) -- `repo` - Reference to a repository where this code originates - -## Format - -```json -{ - "id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>", - "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>", - "created_at": , - "kind": 1337, - "content": "function helloWorld() {\n console.log('Hello, Nostr!');\n}\n\nhelloWorld();", - "tags": [ - ["l", "javascript"], - ["extension", "js"], - ["name", "hello-world.js"], - ["description", "A basic JavaScript function that prints 'Hello, Nostr!' to the console"], - ["runtime", "node v18.15.0"], - ["license", "MIT"], - ["repo", "https://github.com/nostr-protocol/nostr"] - ], - "sig": "<64-bytes signature of the id>" -} -``` - -## Client Behavior - -Clients that support this NIP SHOULD: - -1. Display code snippets with proper syntax highlighting based on the language. -2. Allow copying the full code snippet with a single action. -3. Render the code with appropriate formatting, preserving whitespace and indentation. -4. Display the language and extension prominently. -5. Provide "run" functionality for supported languages when possible. -6. Display the description (if available) as part of the snippet presentation. - -Clients MAY provide additional functionality such as: - -1. Code editing capabilities -2. Forking/modifying snippets -3. Creating executable environments based on the runtime/dependencies -4. Downloading the snippet as a file using the provided extension -5. Sharing the snippet with attribution diff --git a/C0.md b/C0.md new file mode 100644 index 0000000..02cd6c9 --- /dev/null +++ b/C0.md @@ -0,0 +1,65 @@ +# NIP-C0: Code Snippets + +`draft` `optional` + +## Abstract + +This NIP defines a new event kind for sharing and storing code snippets. Unlike regular text notes (`kind:1`), code snippets have specialized metadata like language, extension, and other code-specific attributes that enhance discoverability, syntax highlighting, and improved user experience. + +## Event Kind + +This NIP defines `kind:1337` as a code snippet event. + +The `.content` field contains the actual code snippet text. + +## Optional Tags + +- `l` - Programming language name (lowercase). Examples: "javascript", "python", "rust" +- `name` - Name of the code snippet, commonly a filename. Examples: "hello-world.js", "quick-sort.py" +- `extension` - File extension (without the dot). Examples: "js", "py", "rs" +- `description` - Brief description of what the code does +- `runtime` - Runtime or environment specification (e.g., "node v18.15.0", "python 3.11") +- `license` - License under which the code is shared (e.g., "MIT", "GPL-3.0", "Apache-2.0") +- `dep` - Dependency required for the code to run (can be repeated) +- `repo` - Reference to a repository where this code originates + +## Format + +```json +{ + "id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>", + "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>", + "created_at": , + "kind": 1337, + "content": "function helloWorld() {\n console.log('Hello, Nostr!');\n}\n\nhelloWorld();", + "tags": [ + ["l", "javascript"], + ["extension", "js"], + ["name", "hello-world.js"], + ["description", "A basic JavaScript function that prints 'Hello, Nostr!' to the console"], + ["runtime", "node v18.15.0"], + ["license", "MIT"], + ["repo", "https://github.com/nostr-protocol/nostr"] + ], + "sig": "<64-bytes signature of the id>" +} +``` + +## Client Behavior + +Clients that support this NIP SHOULD: + +1. Display code snippets with proper syntax highlighting based on the language. +2. Allow copying the full code snippet with a single action. +3. Render the code with appropriate formatting, preserving whitespace and indentation. +4. Display the language and extension prominently. +5. Provide "run" functionality for supported languages when possible. +6. Display the description (if available) as part of the snippet presentation. + +Clients MAY provide additional functionality such as: + +1. Code editing capabilities +2. Forking/modifying snippets +3. Creating executable environments based on the runtime/dependencies +4. Downloading the snippet as a file using the provided extension +5. Sharing the snippet with attribution -- cgit v1.2.3