diff --git a/server/src/chat/commands/show.rs b/server/src/chat/commands/show.rs index cadb7d77..be22f484 100644 --- a/server/src/chat/commands/show.rs +++ b/server/src/chat/commands/show.rs @@ -34,9 +34,31 @@ pub(super) fn handle_show(ctx: &CommandContext) -> Option { // `content` comes from the CRDT / content store. If unavailable, report // it rather than silently reading a stale on-disk copy. - Some(content.unwrap_or_else(|| { + let text = content.unwrap_or_else(|| { format!("Story {story_id} found in pipeline but its content is unavailable.") - })) + }); + + // Convert markdown headings to bold text for consistent rendering across + // Matrix clients. Element X doesn't style

tags distinctly, but bold + // text renders consistently everywhere. + let formatted = text + .lines() + .map(|line| { + let trimmed = line.trim_start(); + if let Some(rest) = trimmed.strip_prefix("### ") { + format!("\n**{}**", rest) + } else if let Some(rest) = trimmed.strip_prefix("## ") { + format!("\n**{}**", rest) + } else if let Some(rest) = trimmed.strip_prefix("# ") { + format!("\n**{}**", rest) + } else { + line.to_string() + } + }) + .collect::>() + .join("\n"); + + Some(formatted) } #[cfg(test)]