use std::sync::Arc; use super::*; #[test] fn pointy_brace_open() { html("<!-
\n"); } #[test] fn tasklist() { html_opts!( [extension.tasklist, parse.relaxed_tasklist_matching], "* [*]", "| � | . |
|---|---|
| Z |
\u{15}\u{b}
\n[^ ]:
\u{2}\n
\n-
\n");
}
#[test]
fn commonmark_big_backtick_inline_code() {
commonmark(
"\0` ```````````````````````````````` <`",
"�` ```````````````````````````````` < `\n",
None,
);
}
#[test]
fn commonmark_table_of_fun() {
let mut opts = Options::default();
opts.extension.table = true;
opts.extension.spoiler = true;
opts.render.experimental_minimize_commonmark = true;
commonmark(
"\0I|-|\r-|-|\r\u{c}||~|||",
"| �I | - |\n| --- | --- |\n| \\||~\\|| | |\n",
Some(&opts),
);
}
#[test]
fn tasklist_and_escapes_do_not_play() {
assert_ast_match!(
[],
"\\!",
(document (1:1-1:2) [
(paragraph (1:1-1:2) [
(text (1:2-1:2) "!")
])
])
);
assert_ast_match!(
[parse.escaped_char_spans],
"\\!",
(document (1:1-1:2) [
(paragraph (1:1-1:2) [
(escaped (1:1-1:2) [
(text (1:2-1:2) "!")
])
])
])
);
assert_ast_match!(
[],
"+ \\[x]",
(document (1:1-1:6) [
(list (1:1-1:6) [
(item (1:1-1:6) [
(paragraph (1:3-1:6) [
(text (1:4-1:6) "[x]")
])
])
])
])
);
assert_ast_match!(
[parse.escaped_char_spans],
"+ \\[x]",
(document (1:1-1:6) [
(list (1:1-1:6) [
(item (1:1-1:6) [
(paragraph (1:3-1:6) [
(escaped (1:3-1:4) [
(text (1:4-1:4) "[")
])
(text (1:5-1:6) "x]")
])
])
])
])
);
assert_ast_match!(
[extension.tasklist, parse.relaxed_tasklist_matching],
"+ \\[\\:]",
(document (1:1-1:7) [
(list (1:1-1:7) [
(item (1:1-1:7) [
(paragraph (1:3-1:7) [
(text (1:4-1:7) "[:]")
])
])
])
])
);
assert_ast_match!(
[extension.tasklist, parse.relaxed_tasklist_matching, parse.escaped_char_spans],
"+ \\[\\:]",
(document (1:1-1:7) [
(list (1:1-1:7) [
(item (1:1-1:7) [
(paragraph (1:3-1:7) [
(escaped (1:3-1:4) [
(text (1:4-1:4) "[")
])
(escaped (1:5-1:6) [
(text (1:6-1:6) ":")
])
(text (1:7-1:7) "]")
])
])
])
])
);
}
#[test]
fn dont_try_this_at_home() {
assert_ast_match!(
[extension.alerts, extension.table, parse.ignore_setext],
"\u{3}\n--\nT",
(document (1:1-3:1) [
(table (1:1-3:1) [
(table_row (1:1-1:1) [
(table_cell (1:1-1:1) [
(text (1:1-1:1) "\u{3}")
])
])
(table_row (3:1-3:1) [
(table_cell (3:1-3:1) [
(text (3:1-3:1) "T")
])
])
])
])
);
}
#[test]
fn cargo_run_no_cargo_road() {
assert_ast_match!(
[],
"\t",
(document (1:1-1:1))
);
}
#[test]
fn oye_siri_prende_las_luces() {
assert_ast_match!(
[],
"* ",
(document (1:1-1:2) [
(list (1:1-1:2) [
(item (1:1-1:2))
])
])
);
}
#[test]
fn cursed_lands() {
let mut opts = Options::default();
opts.extension.autolink = true;
opts.extension.footnotes = true;
opts.parse.smart = true;
opts.parse.relaxed_autolinks = true;
markdown_to_html("[^a@b.c--d]", &opts);
}
#[test]
fn inquisitor() {
let mut opts = Options::default();
opts.parse.broken_link_callback = Some(Arc::new(|link_ref: options::BrokenLinkReference| {
Some(ResolvedReference {
url: link_ref.normalized.to_string(),
title: link_ref.original.to_string(),
})
}));
opts.render.width = 45;
markdown_to_commonmark("\0\0\0\0\0\0[\\`\r\n;][ww=\\-", &opts);
}