| 1 |
use super::*; |
| 2 |
use ntest::test_case; |
| 3 |
|
| 4 |
#[test_case("\\@user", "<p><span data-escaped-char>@</span>user</p>\n")] |
| 5 |
#[test_case("This\\@that", "<p>This<span data-escaped-char>@</span>that</p>\n")] |
| 6 |
fn escaped_char_spans(markdown: &str, html: &str) { |
| 7 |
html_opts!([render.escaped_char_spans], markdown, html, no_roundtrip); |
| 8 |
} |
| 9 |
|
| 10 |
#[test_case("\\@user", "<p>@user</p>\n")] |
| 11 |
#[test_case("This\\@that", "<p>This@that</p>\n")] |
| 12 |
fn disabled_escaped_char_spans(markdown: &str, expected: &str) { |
| 13 |
html(markdown, expected); |
| 14 |
} |
| 15 |
|
| 16 |
#[test] |
| 17 |
fn escaped_char_span_sourcepos() { |
| 18 |
assert_ast_match!( |
| 19 |
[render.escaped_char_spans], |
| 20 |
"Test \\`hello world\\` here.", |
| 21 |
(document (1:1-1:26) [ |
| 22 |
(paragraph (1:1-1:26) [ |
| 23 |
(text (1:1-1:5) "Test ") |
| 24 |
(escaped (1:6-1:7) [ |
| 25 |
(text (1:7-1:7) "`") |
| 26 |
]) |
| 27 |
(text (1:8-1:18) "hello world") |
| 28 |
(escaped (1:19-1:20) [ |
| 29 |
(text (1:20-1:20) "`") |
| 30 |
]) |
| 31 |
(text (1:21-1:26) " here.") |
| 32 |
]) |
| 33 |
]) |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
#[test] |
| 38 |
fn to_cm_ok() { |
| 39 |
let mut options = Options::default(); |
| 40 |
options.render.escaped_char_spans = true; |
| 41 |
markdown_to_commonmark("\\]", &options); |
| 42 |
} |