export function formatAge(iso: string): string { const ms = Date.now() - new Date(iso).getTime() const mins = Math.floor(ms / 60000) if (mins < 1) return 'just now' if (mins < 60) return `${mins}m ago` const hours = Math.floor(mins / 60) if (hours < 24) return `${hours}h ago` return `${Math.floor(hours / 24)}d ago` } function escHtml(s: string): string { return s .replace(/&/g, '&') .replace(//g, '>') } export function renderContent(text: string) { return text.split('\n').map((line, i) => { const safe = escHtml(line) const processed = safe.replace(/\*\*(.+?)\*\*/g, '$1') if (line.startsWith('- ') || line.startsWith('* ')) { return (
) } if (line.startsWith('## ') || line.startsWith('# ')) { const txt = line.replace(/^#+\s*/, '') return

{txt}

} if (line.trim() === '') return
return

}) }