| 1 |
use super::*; |
| 2 |
|
| 3 |
#[test] |
| 4 |
fn alerts() { |
| 5 |
html_opts!( |
| 6 |
[extension.alerts], |
| 7 |
concat!("> [!note]\n", "> Pay attention\n",), |
| 8 |
concat!( |
| 9 |
"<div class=\"markdown-alert markdown-alert-note\">\n", |
| 10 |
"<p class=\"markdown-alert-title\">Note</p>\n", |
| 11 |
"<p>Pay attention</p>\n", |
| 12 |
"</div>\n", |
| 13 |
), |
| 14 |
); |
| 15 |
} |
| 16 |
|
| 17 |
#[test] |
| 18 |
fn multiline_alerts() { |
| 19 |
html_opts!( |
| 20 |
[extension.alerts, extension.multiline_block_quotes], |
| 21 |
concat!(">>> [!note]\n", "Pay attention\n", ">>>",), |
| 22 |
concat!( |
| 23 |
"<div class=\"markdown-alert markdown-alert-note\">\n", |
| 24 |
"<p class=\"markdown-alert-title\">Note</p>\n", |
| 25 |
"<p>Pay attention</p>\n", |
| 26 |
"</div>\n", |
| 27 |
), |
| 28 |
); |
| 29 |
} |
| 30 |
|
| 31 |
#[test] |
| 32 |
fn semantic_alerts() { |
| 33 |
html_opts!( |
| 34 |
[ |
| 35 |
extension.alerts = true, |
| 36 |
render.alert_style = options::AlertStyleType::Semantic |
| 37 |
], |
| 38 |
concat!("> [!note]\n", "> Pay attention\n",), |
| 39 |
concat!( |
| 40 |
"<aside class=\"admonition note\">\n", |
| 41 |
"<p class=\"admonition-title\">Note</p>\n", |
| 42 |
"<p>Pay attention</p>\n", |
| 43 |
"</aside>\n", |
| 44 |
), |
| 45 |
); |
| 46 |
} |
| 47 |
|
| 48 |
#[test] |
| 49 |
fn sourcepos() { |
| 50 |
assert_ast_match!( |
| 51 |
[extension.alerts], |
| 52 |
"> [!note]\n" |
| 53 |
"> Pay attention\n", |
| 54 |
(document (1:1-2:15) [ |
| 55 |
(alert (1:1-2:15) [ |
| 56 |
(paragraph (2:3-2:15) [ |
| 57 |
(text (2:3-2:15) "Pay attention") |
| 58 |
]) |
| 59 |
]) |
| 60 |
]) |
| 61 |
); |
| 62 |
} |
| 63 |
|
| 64 |
#[test] |
| 65 |
fn sourcepos_in_list() { |
| 66 |
assert_ast_match!( |
| 67 |
[extension.alerts], |
| 68 |
"- item one\n" |
| 69 |
"\n" |
| 70 |
" > [!note]\n" |
| 71 |
" > Pay attention\n", |
| 72 |
(document (1:1-4:17) [ |
| 73 |
(list (1:1-4:17) [ |
| 74 |
(item (1:1-4:17) [ |
| 75 |
(paragraph (1:3-1:10) [ |
| 76 |
(text (1:3-1:10) "item one") |
| 77 |
]) |
| 78 |
(alert (3:3-4:17) [ |
| 79 |
(paragraph (4:5-4:17) [ |
| 80 |
(text (4:5-4:17) "Pay attention") |
| 81 |
]) |
| 82 |
]) |
| 83 |
]) |
| 84 |
]) |
| 85 |
]) |
| 86 |
); |
| 87 |
} |
| 88 |
|
| 89 |
#[test] |
| 90 |
fn sourcepos_multiline() { |
| 91 |
assert_ast_match!( |
| 92 |
[extension.alerts, extension.multiline_block_quotes], |
| 93 |
">>> [!note]\n" |
| 94 |
"Pay attention\n" |
| 95 |
">>>\n", |
| 96 |
(document (1:1-3:3) [ |
| 97 |
(alert (1:1-2:13) [ |
| 98 |
(paragraph (2:1-2:13) [ |
| 99 |
(text (2:1-2:13) "Pay attention") |
| 100 |
]) |
| 101 |
]) |
| 102 |
]) |
| 103 |
); |
| 104 |
} |
| 105 |
|
| 106 |
#[test] |
| 107 |
fn surprise_eof() { |
| 108 |
assert_ast_match!( |
| 109 |
[extension.alerts], |
| 110 |
"> [!note]\n", |
| 111 |
(document (1:1-1:9) [ |
| 112 |
(alert (1:1-1:9)) |
| 113 |
]) |
| 114 |
); |
| 115 |
|
| 116 |
assert_ast_match!( |
| 117 |
[extension.alerts], |
| 118 |
"> [!note]", |
| 119 |
(document (1:1-1:9) [ |
| 120 |
(alert (1:1-1:9)) |
| 121 |
]) |
| 122 |
); |
| 123 |
} |