diff --git a/crates/ruma-events/src/room/message.rs b/crates/ruma-events/src/room/message.rs index dfaee6fb..18b8b017 100644 --- a/crates/ruma-events/src/room/message.rs +++ b/crates/ruma-events/src/room/message.rs @@ -58,6 +58,12 @@ impl RoomMessageEventContent { Self::new(MessageType::Text(TextMessageEventContent::html(body, html_body))) } + /// A constructor to create a markdown message. + #[cfg(feature = "markdown")] + pub fn text_markdown(body: impl AsRef + Into) -> Self { + Self::new(MessageType::Text(TextMessageEventContent::markdown(body))) + } + /// A constructor to create a plain text notice. pub fn notice_plain(body: impl Into) -> Self { Self::new(MessageType::Notice(NoticeMessageEventContent::plain(body))) @@ -68,6 +74,12 @@ impl RoomMessageEventContent { Self::new(MessageType::Notice(NoticeMessageEventContent::html(body, html_body))) } + /// A constructor to create a markdown notice. + #[cfg(feature = "markdown")] + pub fn notice_markdown(body: impl AsRef + Into) -> Self { + Self::new(MessageType::Notice(NoticeMessageEventContent::markdown(body))) + } + /// Creates a plain text reply to a message. pub fn text_reply_plain(reply: impl Into, original_message: &RoomMessageEvent) -> Self { let quoted = get_plain_quote_fallback(original_message);