Something went wrong. Try again.
A social knowledge tool for research trails, built on ATProto semble.so
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435export interface LinkSource { handle: string; avatar?: string; postUri: string;}
export interface ReaderLink { href: string; text: string; /** Posts that shared the link, in thread order */ sources?: LinkSource[];}
export function normalizeUrl(url: string): string { try { const u = new URL(url); u.hash = ''; return u.toString().replace(/\/$/, ''); } catch { return url; }}
/** http(s) links other than the article itself; null for the rest */export function toReaderLink( href: string, text: string, articleUrl: string,): ReaderLink | null { if (!/^https?:\/\//i.test(href)) return null; if (normalizeUrl(href) === normalizeUrl(articleUrl)) return null;
return { href, text: text.trim() || href };}