function renderTextWithStyles(text) { if (!text) return '' return String(text) .replace(/&/g, '&') .replace(//g, '>') .replace(/@([A-Za-z0-9+/=.\-]+\.ed25519)/g, (_, id) => `@${id}` ) .replace(/#(\w+)/g, (_, tag) => `#${tag}` ) .replace(/(https?:\/\/[^\s]+)/g, url => `${url}` ) .replace(/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g, email => `${email}` ) } module.exports = { renderTextWithStyles }