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.

Insert mu.social mention links; parse both hosts on publish

+24 -3
+1 -1
src/lib/editor/mention-autocompleter.test.ts
··· 40 40 // place of the typed `@query` rather than swapping out the whole block. 41 41 const completion = completer.getOptionCompletion( ALICE ); 42 42 const html = renderToString( completion ); 43 - expect( html ).toContain( 'href="https://bsky.app/profile/alice.bsky.social"' ); 43 + expect( html ).toContain( 'href="https://mu.social/profile/alice.bsky.social"' ); 44 44 expect( html ).toContain( 'data-did="did:plc:alice"' ); 45 45 expect( html ).toContain( '@alice.bsky.social' ); 46 46 } );
+2 -1
src/lib/editor/mention-autocompleter.ts
··· 1 1 import { createElement } from '@wordpress/element'; 2 2 import { addFilter, hasFilter } from '@wordpress/hooks'; 3 3 import { lookupActor, type ActorPreview } from '../landing/actor-lookup'; 4 + import { atmosphereProfileUrl } from '../social/atmosphere-url'; 4 5 5 6 type LookupFn = ( query: string ) => Promise< ActorPreview | null >; 6 7 ··· 63 64 return createElement( 64 65 'a', 65 66 { 66 - href: `https://bsky.app/profile/${ option.handle }`, 67 + href: atmosphereProfileUrl( option.handle ), 67 68 className: 'skypress-mention', 68 69 'data-did': option.did, 69 70 },
+20
src/lib/publish/mentions.test.ts
··· 19 19 ] ); 20 20 } ); 21 21 22 + it( 'parses a mention whose href points at mu.social', () => { 23 + const blocks = [ 24 + para( 25 + 'Hi <a class="skypress-mention" href="https://mu.social/profile/alice.bsky.social" data-did="did:plc:alice">@alice.bsky.social</a>!' 26 + ), 27 + ]; 28 + expect( collectMentions( blocks ) ).toEqual( [ 29 + { did: 'did:plc:alice', handle: 'alice.bsky.social', displayText: '@alice.bsky.social' }, 30 + ] ); 31 + } ); 32 + 33 + it( 'derives the handle from a mu.social href even when the text is not a handle', () => { 34 + const blocks = [ 35 + para( 36 + '<a class="skypress-mention" href="https://mu.social/profile/alice.bsky.social" data-did="did:plc:alice">Alice</a>' 37 + ), 38 + ]; 39 + expect( collectMentions( blocks )[ 0 ].handle ).toBe( 'alice.bsky.social' ); 40 + } ); 41 + 22 42 it( 'ignores ordinary links that are not mentions', () => { 23 43 const blocks = [ para( 'See <a href="https://example.com">the docs</a>.' ) ]; 24 44 expect( collectMentions( blocks ) ).toEqual( [] );
+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|mu\.social)\/profile\/([^/?#]+)/; 11 11 12 12 /** 13 13 * Scan a block tree for `skypress/mention` anchors (`<a data-did="…">`) and return