1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/// Creates a [`Node::Comment`][crate::Node::Comment].
#[macro_export]
macro_rules! comment {
    ($($tt:tt)*) => {
        ::html_node::Node::Comment(::html_node::Comment {
            comment: ::std::format!($($tt)*),
        })
    };
}

/// Creates a [`Node::Text`][crate::Node::Text].
#[macro_export]
macro_rules! text {
    ($($tt:tt)*) => {
        ::html_node::Node::Text(::html_node::Text {
            text: ::std::format!($($tt)*),
        })
    };
}

/// Creates a [`Node::UnsafeText`][crate::Node::UnsafeText].
///
/// # Warning
///
/// [`Node::UnsafeText`][crate::Node::UnsafeText] is not escaped when rendered,
/// and as such, can allow for XSS attacks. Use with caution!
#[macro_export]
macro_rules! unsafe_text {
    ($($tt:tt)*) => {
        ::html_node::Node::UnsafeText(::html_node::UnsafeText {
            text: ::std::format!($($tt)*),
        })
    };
}