feat: resolve NIP-19 identifiers in article content

- Add nostrUriResolver utility to detect and replace nostr: URIs
- Support npub, note, nprofile, nevent, and naddr identifiers
- Convert nostr: URIs to clickable njump.me links
- Process markdown before rendering to handle nostr mentions
- Add CSS styling for nostr-uri-link class
- Implements NIP-19 and NIP-27 (nostr: URI scheme)

Nostr-native articles can now contain references like:
- nostr:npub1... → @npub1abc...
- nostr:note1... → note:note1abc...
- nostr:naddr1... → article:identifier

All identifiers become clickable links to njump.me
This commit is contained in:
Gigi
2025-10-11 01:42:03 +01:00
parent 6783ff23f9
commit 8a69d5bc6b
4 changed files with 167 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
onTextSelection,
onClearSelection
}) => {
const { renderedHtml: renderedMarkdownHtml, previewRef: markdownPreviewRef } = useMarkdownToHTML(markdown)
const { renderedHtml: renderedMarkdownHtml, previewRef: markdownPreviewRef, processedMarkdown } = useMarkdownToHTML(markdown)
const { finalHtml, relevantHighlights } = useHighlightedContent({
html,
@@ -116,7 +116,7 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
{markdown && (
<div ref={markdownPreviewRef} style={{ display: 'none' }}>
<ReactMarkdown remarkPlugins={[remarkGfm]}>
{markdown}
{processedMarkdown || markdown}
</ReactMarkdown>
</div>
)}