A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

Cover mention handle fallback + tighten profile regex

+17 -1
+16
src/lib/publish/mentions.test.ts
··· 47 47 expect( collectMentions( blocks ).map( ( m ) => m.did ) ).toEqual( [ 'did:plc:carol' ] ); 48 48 } ); 49 49 50 + it( 'derives the handle from the text when the href is not a bsky profile', () => { 51 + const blocks = [ 52 + { 53 + name: 'core/paragraph', 54 + attributes: { 55 + content: 56 + '<a class="skypress-mention" href="" data-did="did:plc:dave">@dave.example.com</a>', 57 + }, 58 + innerBlocks: [], 59 + }, 60 + ]; 61 + expect( collectMentions( blocks ) ).toEqual( [ 62 + { did: 'did:plc:dave', handle: 'dave.example.com', displayText: '@dave.example.com' }, 63 + ] ); 64 + } ); 65 + 50 66 it( 'returns [] when there are no blocks', () => { 51 67 expect( collectMentions( [] ) ).toEqual( [] ); 52 68 } );
+1 -1
src/lib/publish/mentions.ts
··· 7 7 displayText: string; 8 8 } 9 9 10 - const PROFILE_RE = /^https?:\/\/bsky\.app\/profile\/(.+)$/; 10 + const PROFILE_RE = /^https?:\/\/bsky\.app\/profile\/([^/?#]+)/; 11 11 12 12 /** 13 13 * Scan a block tree for `skypress/mention` anchors (`<a data-did="…">`) and return