/** * Single source of truth for :emoji: shortcodes and nostr: bech32 patterns. * Used by MarkdownArticle, parseContent, previews, post editor, AsciiDoc, etc. */ // --- Emoji (:shortcode:) ---------------------------------------------------- export const EMOJI_SHORT_CODE_MAX_INNER_LENGTH = 20 as const const _emojiInnerQuantifier = EMOJI_SHORT_CODE_MAX_INNER_LENGTH - 1 /** * - (?|\\]|,|\\.|!|\\?|;|:)' export const NOSTR_PARSER_REGEX = new RegExp( `(?:^|\\s|>|\\[)nostr:(${NOSTR_CONTENT_BECH32_ALT})${NOSTR_PARSER_LOOKAHEAD}`, 'g' ) /** AsciiDoc: optional [] after nostr id */ export const NOSTR_ASCIIDOC_EARLY_LINK_REGEX = new RegExp( `nostr:(${NOSTR_ASCIIDOC_SOURCE_BECH32_ALT})(\\[\\])?`, 'g' ) /** AsciiDoc HTML: same capture groups as early link, for text-node scanning */ export const NOSTR_ASCIIDOC_TEXT_NODE_REGEX = new RegExp( `nostr:(${NOSTR_ASCIIDOC_SOURCE_BECH32_ALT})(\\[\\])?`, 'g' )