From d0dc1d9154151f1afea66d67474f0588bac640af Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 30 Sep 2024 10:39:01 -0700 Subject: [PATCH] Update regex for entities --- src/__tests__/parser.test.ts | 57 +---------------------------- src/extensions/Bolt11Extension.ts | 2 +- src/extensions/NAddrExtension.ts | 2 +- src/extensions/NEventExtension.ts | 4 +- src/extensions/NProfileExtension.ts | 4 +- 5 files changed, 8 insertions(+), 61 deletions(-) diff --git a/src/__tests__/parser.test.ts b/src/__tests__/parser.test.ts index 3742d49..ea97968 100644 --- a/src/__tests__/parser.test.ts +++ b/src/__tests__/parser.test.ts @@ -554,30 +554,7 @@ https://host.com/2.jpeg "type": "link", }, ], - "text": "https://github.com/", - "type": "text", - }, - { - "attrs": { - "nprofile": "nostr:npub1cesrkrcuelkxyhvupzm48e8hwn4005w0ya5jyvf9kh75mfegqx0q4kt37c", - "pubkey": "c6603b0f1ccfec625d9c08b753e4f774eaf7d1cf2769223125b5fd4da728019e", - "relays": [], - }, - "type": "nprofile", - }, - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://github.com/nostr:npub1cesrkrcuelkxyhvupzm48e8hwn4005w0ya5jyvf9kh75mfegqx0q4kt37c/wrong/link/", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "/wrong/link/", + "text": "https://github.com/nostr:npub1cesrkrcuelkxyhvupzm48e8hwn4005w0ya5jyvf9kh75mfegqx0q4kt37c/wrong/link/", "type": "text", }, { @@ -596,37 +573,7 @@ https://host.com/2.jpeg "type": "link", }, ], - "text": "https://github.com/", - "type": "text", - }, - ], - "type": "paragraph", - }, - { - "attrs": { - "author": "0a5a87baeead12b08c0c026caa46c009bb533aae1bd1681f52d609dd2b6fd8bc", - "id": "2ceb90d42ab5a19b76dddfbda45687bc8011917a41286783edd14ca690fd86ee", - "kind": null, - "nevent": "nostr:nevent1qgsq5k58hth26y4s3sxqym92gmqqnw6n82hph5tgrafdvzwa9dha30qqyqkwhyx59266rxmkmh0mmfzks77gqyv30fqjseurahg5ef5slkrwuzwpwzp", - "relays": [], - }, - "type": "nevent", - }, - { - "content": [ - { - "marks": [ - { - "attrs": { - "class": null, - "href": "https://github.com/nostr:nevent1qgsq5k58hth26y4s3sxqym92gmqqnw6n82hph5tgrafdvzwa9dha30qqyqkwhyx59266rxmkmh0mmfzks77gqyv30fqjseurahg5ef5slkrwuzwpwzp/error", - "rel": "noopener noreferrer nofollow", - "target": "_blank", - }, - "type": "link", - }, - ], - "text": "/error", + "text": "https://github.com/nostr:nevent1qgsq5k58hth26y4s3sxqym92gmqqnw6n82hph5tgrafdvzwa9dha30qqyqkwhyx59266rxmkmh0mmfzks77gqyv30fqjseurahg5ef5slkrwuzwpwzp/error", "type": "text", }, { diff --git a/src/extensions/Bolt11Extension.ts b/src/extensions/Bolt11Extension.ts index 352f6ac..e2d62ad 100644 --- a/src/extensions/Bolt11Extension.ts +++ b/src/extensions/Bolt11Extension.ts @@ -5,7 +5,7 @@ import { decode } from 'light-bolt11-decoder' import type { MarkdownSerializerState } from 'prosemirror-markdown' import { createPasteRuleMatch } from '../helpers/utils' -const LNBC_REGEX = /(?:^|\s)(lnbc[0-9a-z]{10,})/g +const LNBC_REGEX = /(?