longform: Fix NIP-19 nostr links not rendering in markdown content #3428
+244
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Summary
nostr:prefixed URIs and bare bech32 entities for consistency with kind1 notesChecklist
Standard PR Checklist
- [x] My PR is either small, or I have split it into smaller logical commits that are easier to review
Closes:orFixes:tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patchesTest report
Device: iPhone 15 Pro (Simulator)
iOS: 18.0
Damus: Current master + this PR
Setup: Longform article containing nprofile, npub, note, and nevent mentions both with and without nostr: prefix
Steps:
xcodebuild test -scheme damus -destination 'platform=iOS Simulator,name=iPhone 15 Pro'Results:
Other notes
This fix addresses issue #3426 where nostr:nprofile links in longform articles were rendering as plain text instead of clickable mentions.
The implementation preprocesses markdown content before passing to MarkdownUI, converting nostr entities into standard markdown link syntax that MarkdownUI can render. Profile display names are looked up from the cache, with a fallback to abbreviated bech32 format (e.g.,
@npub1abc:xyz) when the profile isn't available.🤖 Generated with Claude Code