Add test for smart punctuation

This commit is contained in:
Eric Huss 2025-04-21 19:09:26 -07:00
parent 6904653a82
commit 8c8f0a4dbf
3 changed files with 44 additions and 0 deletions

View file

@ -108,3 +108,39 @@ Carrots</li>
"##]],
);
}
// Smart punctuation test.
#[test]
fn smart_punctuation() {
BookTest::from_dir("markdown/smart_punctuation")
// Default is off.
.check_main_file(
"book/smart_punctuation.html",
str![[r##"
<h1 id="smart-punctuation"><a class="header" href="#smart-punctuation">Smart Punctuation</a></h1>
<ul>
<li>En dash: --</li>
<li>Em dash: ---</li>
<li>Ellipsis: ...</li>
<li>Double quote: "quote"</li>
<li>Single quote: 'quote'</li>
</ul>
"##]],
)
.run("build", |cmd| {
cmd.env("MDBOOK_OUTPUT__HTML__SMART_PUNCTUATION", "true");
})
.check_main_file(
"book/smart_punctuation.html",
str![[r##"
<h1 id="smart-punctuation"><a class="header" href="#smart-punctuation">Smart Punctuation</a></h1>
<ul>
<li>En dash: </li>
<li>Em dash: </li>
<li>Ellipsis: </li>
<li>Double quote: quote</li>
<li>Single quote: quote</li>
</ul>
"##]],
);
}

View file

@ -0,0 +1 @@
- [Smart Punctuation](smart_punctuation.md)

View file

@ -0,0 +1,7 @@
# Smart Punctuation
- En dash: --
- Em dash: ---
- Ellipsis: ...
- Double quote: "quote"
- Single quote: 'quote'