Skip to main content

md

Macro md 

Source
macro_rules! md {
    ($e : expr) => { ... };
    ($e : expr, $($es:expr),+ $(,)?) => { ... };
}
Expand description

Builds a SlackBlockMarkDownText, converted into the caller’s target type via Into.

md!(text) wraps text as-is; md!(fmt, args...) formats first, the same way format! does.

Because the expansion already ends in an untyped .into(), a bare md!(..) item cannot be placed directly into slack_blocks! for a text-only list — the compiler has nothing to infer the target type from (E0283). Wrap it with some(..) (slack_blocks![some(md!("hi"))]) or give the list an explicit element type, e.g. SlackContextBlock::new(vec![md!("hi")]).

use slack_morphism::prelude::*;

let text: SlackBlockMarkDownText = md!("hello");
let formatted: SlackBlockMarkDownText = md!("hello {}", "world");