use super::*;
#[test]
fn header_id_prefix() {
html_opts_i(
concat!(
"# Hi.\n",
"## Hi 1.\n",
"### Hi.\n",
"#### Hello.\n",
"##### Hi.\n",
"###### Hello.\n",
"# Isn't it grand?"
),
concat!(
"
Hi.
\n",
"Hi 1.
\n",
"Hi.
\n",
"Hello.
\n",
"Hi.
\n",
"Hello.
\n",
"Isn't it grand?
\n"
),
true,
|opts| opts.extension.header_id_prefix = Some("user-content-".to_owned()),
);
}
#[test]
fn header_ids_prefix_in_href() {
html_opts_i(
concat!(
"# Hi.\n",
"## Hi 1.\n",
"### Hi.\n",
"#### Hello.\n",
"##### Hi.\n",
"###### Hello.\n",
"# Isn't it grand?"
),
concat!(
"Hi.
\n",
"Hi 1.
\n",
"Hi.
\n",
"Hello.
\n",
"Hi.
\n",
"Hello.
\n",
"Isn't it grand?
\n"
),
true,
|opts| {
opts.extension.header_id_prefix = Some("user-content-".to_owned());
opts.extension.header_id_prefix_in_href = true;
},
);
}
#[test]
fn header_id_prefix_in_href_without_prefix() {
// When header_id_prefix is None, header_id_prefix_in_href has no effect
html_opts_i("# Hi.\n", "Hi.
\n", true, |opts| {
opts.extension.header_id_prefix_in_href = true;
});
}