You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
snekdown/src/utils/macros.rs

55 lines
1.0 KiB
Rust

/*
* Snekdown - Custom Markdown flavour and parser
* Copyright (C) 2021 Trivernis
* See LICENSE for more information.
*/
#[macro_export]
macro_rules! plain_text {
($e:expr) => {
Inline::Plain(PlainText { value: $e })
};
}
#[macro_export]
macro_rules! bold_text {
($e:expr) => {
Inline::Bold(BoldText {
value: vec![Inline::Plain(PlainText { value: $e })],
})
};
}
#[macro_export]
macro_rules! italic_text {
($e:expr) => {
Inline::Italic(ItalicText {
value: vec![Inline::Plain(PlainText { value: $e })],
})
};
}
#[macro_export]
macro_rules! url_text {
($e:expr) => {
Inline::Url(Url {
url: $e,
description: None,
})
};
}
#[macro_export]
macro_rules! list_item {
($e:expr, $k:expr) => {
ListItem::new(
Line::Anchor(Anchor {
inner: Box::new(Line::Text($e)),
key: $k,
}),
0,
true,
)
};
}