ITADN

NIP-23: Long-form Content Support

#116Pull Requestalltheseas 创建于 2026-01-06
A
alltheseascommented
## Summary Add NIP-23 long-form content (kind 30023/30024) support to nostrdb: - Integrate libcmark for markdown parsing - Add 14 new block types for markdown elements (headings, code blocks, lists, links, images, etc.) - Add `ndb_parse_markdown_content()` to parse markdown into nostrdb blocks - Add NIP-23 metadata helpers for title, summary, image, identifier, published_at, hashtags - Automatic `nostr:` URI detection in markdown links (converted to BLOCK_MENTION_BECH32) - Image alt text capture from child text nodes - Version field in blocks for v1/v2 format distinction ## Changes - `src/markdown_parser.c` - New file: cmark-based markdown parser - `src/nip23.c` - New file: NIP-23 metadata extraction helpers - `src/nostrdb.h` - Extended block types enum, new structs - `src/block.c` - v2 block parsing with inline string storage - `src/content_parser.c` - Switch cases for new block types - `src/cursor.h` - Fixed cursor_skip() off-by-one bug - `Makefile` - cmark library integration - `test.c` - Markdown parsing tests - `CHANGELOG.md` - New file ## Test plan - [x] All existing tests pass - [x] New tests for markdown parsing, code blocks, links, lists - [x] Test exact block counts to catch duplicate pushes - [x] Test BLOCK_MENTION_BECH32 string access for v2 - [x] Test image alt text capture Closes #32 Signed-off-by: alltheseas <alltheseas@users.noreply.github.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added NIP-23 long-form content support with full Markdown parsing capabilities * Introduced automatic nostr URI detection and conversion in Markdown links * Added helpers to extract long-form article metadata (title, image, summary, identifier, publication date, hashtags) * Image alt text now captured from Markdown * **Bug Fixes** * Fixed off-by-one error in cursor boundary validation * **Tests** * Added comprehensive Markdown parsing test suite <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
合并状态:未合并 1 条评论