feat: render embedded invoices (#392)

This commit is contained in:
Daniel Vergara
2025-06-19 08:12:06 -06:00
committed by GitHub
parent d7dc098995
commit f25b742877
7 changed files with 126 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
EMOJI_SHORT_CODE_REGEX,
HASHTAG_REGEX,
IMAGE_REGEX,
LN_INVOICE_REGEX,
URL_REGEX,
VIDEO_REGEX,
WS_URL_REGEX
@@ -21,6 +22,7 @@ export type TEmbeddedNodeType =
| 'websocket-url'
| 'url'
| 'emoji'
| 'invoice'
export type TEmbeddedNode =
| {
@@ -79,6 +81,11 @@ export const EmbeddedEmojiParser: TContentParser = {
regex: EMOJI_SHORT_CODE_REGEX
}
export const EmbeddedLNInvoiceParser: TContentParser = {
type: 'invoice',
regex: LN_INVOICE_REGEX
}
export function parseContent(content: string, parsers: TContentParser[]) {
let nodes: TEmbeddedNode[] = [{ type: 'text', data: content.trim() }]