Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

491 B
Raw Blame
/** Bounded image projection for cards; accepts the same URL schemes as MarkdownOutput. */
export function markdownImages(content, limit = 4) {
  const images = [];
  const seen = new Set();
  for (const match of String(content || '').matchAll(/!\[([^\]]*)\]\(([^)]+)\)/g)) {
    const [, alt, src] = match;
    if (!/^(https?:\/\/|\/[^/])/.test(src) || seen.has(src)) continue;
    seen.add(src);
    images.push({ src, alt });
    if (images.length >= limit) break;
  }
  return images;
}