Package to turn nostr Markdown into an Abstract Syntax Tree.
Every Nostr client handles content parsing differently. Almost every Nostr client I tested has bugs when it comes to parsing markdown.
I created this library to scratch my own itch for asknostr.site.
- [x] Paragraphs
- [ ] Formatting
- [x] Emphasis
- [ ] Formatting: Italic
- [ ] Bold
- [ ] Headings
- [ ] Line Breaks
- [ ] BlockQuotes
- [ ] Lists
- [ ] Code
- [ ] Horizontal Rules
- [x] Links
- [x] Markdown Links
- [x] Literal Links
- [x] Images
- [x] Markdown Images
- [x] Literal Images
- [x] Hashtags
- [x] Video/Youtube
- [ ] Nostr Entities
- [x] Mentions (nostr:nprofile nostr:npub npub1... nprofile1...)
- [x] Other nostr mentions (nostr:note nostr:nevent note1...m nevent1...)
- [x] Strip endlines from top/bottom of markdown
Anyone making chili today? What’s your secret ingredient? #foodstr #asknostr
{
type: "root",
children: [
{
type: "paragraph",
children: [
{
type: "text",
value: "Anyone making chili today? What’s your secret ingredient? ",
},
{ type: "hashtag", name: "foodstr", hashtag: "#foodstr" },
{ type: "text", value: " " },
{ type: "hashtag", name: "asknostr", hashtag: "#asknostr" },
],
},
],
}