use chat::Mention; use gpui::{App, Entity}; use person::PersonRegistry; use ui::markdown::InlineReplacement; pub use ui::markdown::RenderedText; /// Render message `content`, replacing mentions with their display names. pub fn rendered_text( content: &str, mentions: &[Mention], persons: &Entity, cx: &App, ) -> RenderedText { let replacements = mentions .iter() .map(|mention| { InlineReplacement::new( mention.range.clone(), format!("@{}", persons.read(cx).get(&mention.public_key, cx).name()), ) }) .collect::>(); RenderedText::new(content, &replacements) }