From 91fc85b645fe732d056ecbeff5aa28d3a3a33a28 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Fri, 31 Oct 2025 04:51:21 +0100 Subject: [PATCH] implemented 30817 --- .../Note/MarkdownArticle/MarkdownArticle.tsx | 2 +- .../Note/PublicationIndex/PublicationIndex.tsx | 9 +++++++++ src/components/Note/index.tsx | 11 +++++++++-- src/components/Profile/ProfileArticles.tsx | 4 ++-- src/constants.ts | 2 ++ src/lib/markup-detection.ts | 7 ++++++- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/Note/MarkdownArticle/MarkdownArticle.tsx b/src/components/Note/MarkdownArticle/MarkdownArticle.tsx index 8827fa02..d58e3873 100644 --- a/src/components/Note/MarkdownArticle/MarkdownArticle.tsx +++ b/src/components/Note/MarkdownArticle/MarkdownArticle.tsx @@ -505,7 +505,7 @@ export default function MarkdownArticle({ )} - {/* Image Carousel - Only show for article content (30023, 30041, 30818) */} + {/* Image Carousel - Only show for article content (30023, 30041, 30817, 30818) */} {showImageGallery && allImages.length > 0 && ( diff --git a/src/components/Note/PublicationIndex/PublicationIndex.tsx b/src/components/Note/PublicationIndex/PublicationIndex.tsx index dc706a8b..b1054a57 100644 --- a/src/components/Note/PublicationIndex/PublicationIndex.tsx +++ b/src/components/Note/PublicationIndex/PublicationIndex.tsx @@ -3,6 +3,7 @@ import { Event } from 'nostr-tools' import { useEffect, useMemo, useState } from 'react' import { cn } from '@/lib/utils' import AsciidocArticle from '../AsciidocArticle/AsciidocArticle' +import MarkdownArticle from '../MarkdownArticle/MarkdownArticle' import { generateBech32IdFromATag } from '@/lib/tag' import client from '@/services/client.service' import logger from '@/lib/logger' @@ -109,6 +110,7 @@ export default function PublicationIndex({ if (!isNaN(kind) && kind === ExtendedKind.PUBLICATION_CONTENT || kind === ExtendedKind.WIKI_ARTICLE || + kind === ExtendedKind.WIKI_ARTICLE_MARKDOWN || kind === ExtendedKind.PUBLICATION) { // For this simplified version, we'll just extract the title from the coordinate const nestedTitle = identifier || 'Untitled' @@ -416,6 +418,13 @@ export default function PublicationIndex({ ) + } else if (ref.kind === ExtendedKind.WIKI_ARTICLE_MARKDOWN) { + // Render 30817 content as MarkdownArticle + return ( +
+ +
+ ) } else { // Fallback for other kinds - just show a placeholder return ( diff --git a/src/components/Note/index.tsx b/src/components/Note/index.tsx index 05e01568..b700cf03 100644 --- a/src/components/Note/index.tsx +++ b/src/components/Note/index.tsx @@ -106,6 +106,12 @@ export default function Note({ ) : ( ) + } else if (event.kind === ExtendedKind.WIKI_ARTICLE_MARKDOWN) { + content = showFull ? ( + + ) : ( + + ) } else if (event.kind === ExtendedKind.PUBLICATION) { content = showFull ? ( @@ -160,10 +166,11 @@ export default function Note({ content = } else { // Use MarkdownArticle for all other kinds - // Only 30023, 30041, and 30818 will show image gallery and article info + // Only 30023, 30041, 30817, and 30818 will show image gallery and article info const showImageGallery = event.kind === kinds.LongFormArticle || event.kind === ExtendedKind.PUBLICATION_CONTENT || - event.kind === ExtendedKind.WIKI_ARTICLE + event.kind === ExtendedKind.WIKI_ARTICLE || + event.kind === ExtendedKind.WIKI_ARTICLE_MARKDOWN content = } diff --git a/src/components/Profile/ProfileArticles.tsx b/src/components/Profile/ProfileArticles.tsx index 94370bb6..93f80099 100644 --- a/src/components/Profile/ProfileArticles.tsx +++ b/src/components/Profile/ProfileArticles.tsx @@ -80,10 +80,10 @@ const ProfileArticles = forwardRef<{ refresh: () => void }, ProfileArticlesProps const comprehensiveRelays = await buildComprehensiveRelayList() console.log('[ProfileArticles] Using comprehensive relay list:', comprehensiveRelays.length, 'relays') - // Fetch longform articles (kind 30023), wiki articles (kind 30818), publications (kind 30040), and highlights (kind 9802) + // Fetch longform articles (kind 30023), wiki articles (kinds 30817, 30818), publications (kind 30040), and highlights (kind 9802) const allEvents = await client.fetchEvents(comprehensiveRelays, { authors: [pubkey], - kinds: [kinds.LongFormArticle, 30818, 30040, kinds.Highlights], // LongFormArticle, WikiArticle, Publication, and Highlights + kinds: [kinds.LongFormArticle, 30817, 30818, 30040, kinds.Highlights], // LongFormArticle, WikiArticle (markdown), WikiArticle (asciidoc), Publication, and Highlights limit: 100 }) diff --git a/src/constants.ts b/src/constants.ts index 496b079e..ddfd8a74 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -137,6 +137,7 @@ export const ExtendedKind = { ZAP_RECEIPT: 9735, PUBLICATION: 30040, WIKI_ARTICLE: 30818, + WIKI_ARTICLE_MARKDOWN: 30817, PUBLICATION_CONTENT: 30041, // NIP-89 Application Handlers APPLICATION_HANDLER_RECOMMENDATION: 31989, @@ -161,6 +162,7 @@ export const SUPPORTED_KINDS = [ ExtendedKind.ZAP_RECEIPT, ExtendedKind.PUBLICATION, ExtendedKind.WIKI_ARTICLE, + ExtendedKind.WIKI_ARTICLE_MARKDOWN, ExtendedKind.PUBLICATION_CONTENT, // NIP-89 Application Handlers ExtendedKind.APPLICATION_HANDLER_RECOMMENDATION, diff --git a/src/lib/markup-detection.ts b/src/lib/markup-detection.ts index 50cc8603..42b11a2e 100644 --- a/src/lib/markup-detection.ts +++ b/src/lib/markup-detection.ts @@ -8,11 +8,16 @@ export type MarkupType = 'asciidoc' | 'advanced-markdown' | 'basic-markdown' | ' * Detect the type of markup used in content */ export function detectMarkupType(content: string, eventKind?: number): MarkupType { - // Publications and wikis use AsciiDoc + // Publications and wiki articles (30818) use AsciiDoc if (eventKind === 30041 || eventKind === 30818) { return 'asciidoc' } + // Wiki articles (30817) use markdown + if (eventKind === 30817) { + return 'advanced-markdown' + } + // Long Form Articles (kind 30023) should use markdown detection if (eventKind === 30023) { // Force markdown detection for long form articles