diff --git a/crates/typst-html/src/convert.rs b/crates/typst-html/src/convert.rs
index e50d104e7..220023897 100644
--- a/crates/typst-html/src/convert.rs
+++ b/crates/typst-html/src/convert.rs
@@ -89,7 +89,7 @@ fn handle(
let quote = quoter.quote(before, "es, double);
output.push(HtmlNode::text(quote, child.span()));
} else {
- output.push(HtmlNode::text(if double { '"' } else { '\'' }, child.span()));
+ output.push(HtmlNode::text(SmartQuotes::fallback(double), child.span()));
}
} else if let Some(elem) = child.to_packed::() {
let locator = locator.next(&elem.span());
diff --git a/crates/typst-layout/src/inline/collect.rs b/crates/typst-layout/src/inline/collect.rs
index 6b6b24579..f19c1ab4f 100644
--- a/crates/typst-layout/src/inline/collect.rs
+++ b/crates/typst-layout/src/inline/collect.rs
@@ -196,7 +196,7 @@ pub fn collect<'a>(
let quote = quoter.quote(before, "es, double);
collector.push_text(quote, styles);
} else {
- collector.push_text(if double { "\"" } else { "'" }, styles);
+ collector.push_text(SmartQuotes::fallback(double), styles);
}
} else if let Some(elem) = child.to_packed::() {
collector.push_item(Item::Skip(LTR_ISOLATE));
diff --git a/crates/typst-library/src/text/smartquote.rs b/crates/typst-library/src/text/smartquote.rs
index c90b4b1a6..a43335aee 100644
--- a/crates/typst-library/src/text/smartquote.rs
+++ b/crates/typst-library/src/text/smartquote.rs
@@ -89,11 +89,7 @@ pub struct SmartQuoteElem {
impl PlainText for Packed {
fn plain_text(&self, text: &mut EcoString) {
- if self.double.as_option().unwrap_or(true) {
- text.push_str("\"");
- } else {
- text.push_str("'");
- }
+ text.push_str(SmartQuotes::fallback(self.double.as_option().unwrap_or(true)));
}
}
@@ -305,6 +301,11 @@ impl<'s> SmartQuotes<'s> {
pub fn close(&self, double: bool) -> &'s str {
if double { self.double_close } else { self.single_close }
}
+
+ /// Get the fallback "dumb" quotes for when smart quotes are disabled.
+ pub fn fallback(double: bool) -> &'static str {
+ if double { "\"" } else { "'" }
+ }
}
/// An opening and closing quote.