1 2 3 /// print a markdown template, with other arguments taking `$0` to `$9` places in the template. 4 /// 5 /// Example: 6 /// 7 /// ``` 8 /// use lazy_static::lazy_static; 9 /// use minimad::mad_inline; 10 /// use termimad::*; 11 /// 12 /// let skin = MadSkin::default(); 13 /// mad_print_inline!( 14 /// &skin, 15 /// "**$0 formula:** *$1*", // the markdown template, interpreted once 16 /// "Disk", // fills $0 17 /// "2*π*r", // fills $1. Note that the stars don't mess the markdown 18 /// ); 19 /// ``` 20 #[macro_export] 21 macro_rules! mad_print_inline { 22 ($skin: expr, $md: literal $(, $value: expr )* $(,)? ) => { 23 $skin.print_composite(mad_inline!($md $(, $value)*)); 24 }; 25 } 26 27 /// write a markdown template, with other arguments taking `$0` to `$9` places in the template. 28 /// 29 /// Example: 30 /// 31 /// ``` 32 /// use lazy_static::lazy_static; 33 /// use minimad::mad_inline; 34 /// use termimad::*; 35 /// 36 /// let skin = MadSkin::default(); 37 /// mad_write_inline!( 38 /// &mut std::io::stdout(), 39 /// &skin, 40 /// "**$0 formula:** *$1*", // the markdown template, interpreted once 41 /// "Disk", // fills $0 42 /// "2*π*r", // fills $1. Note that the stars don't mess the markdown 43 /// ).unwrap(); 44 /// ``` 45 #[macro_export] 46 macro_rules! mad_write_inline { 47 ($w: expr, $skin: expr, $md: literal $(, $value: expr )* $(,)? ) => {{ 48 use std::io::Write; 49 $skin.write_composite($w, mad_inline!($md $(, $value)*)) 50 }}; 51 } 52 53 54 55