Macro minimad::mad_inline
source · [−]macro_rules! mad_inline {
( $md: literal $(, $value: expr )* $(,)? ) => { ... };
}
Expand description
build an inline from a string literal intepreted as markdown and
optional arguments which may fill places designed as $0
..$9
Differences with parsing a string built with format!
:
- the arguments aren’t interpreted as markdown, which is convenient to insert user supplied strings in a markdown template.
- markdown parsing and template building are done only once (the template is stored in a lazy static)
- arguments can be omited, repeated, or given in arbitrary order
- no support for fmt parameters or arguments other than
&str
Example:
use minimad::*;
let composite = mad_inline!(
"**$0 formula:** *$1*", // the markdown template, interpreted only once
"Disk", // fills $0
"2*π*r", // fills $1. Note that the stars don't mess the markdown
);