Fix smartquotes after inline equations (#5149)

This commit is contained in:
Yip Coekjan 2024-10-08 16:37:11 +08:00 committed by GitHub
parent 037c0c8216
commit 7a96c86487
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -131,9 +131,12 @@ impl SmartQuoter {
}
// If we have a single smart quote, didn't recently open a single
// quotation, and are after an alphabetic char, interpret this as an
// apostrophe.
if !double && opened != Some(false) && before.is_alphabetic() {
// quotation, and are after an alphabetic char or an object (e.g. a
// math equation), interpret this as an apostrophe.
if !double
&& opened != Some(false)
&& (before.is_alphabetic() || before == '\u{FFFC}')
{
return "";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

View File

@ -165,3 +165,6 @@ Some people's thought on this would be #[#set smartquote(enabled: false); "stran
"test"\
"test"
--- issue-5146-smartquotes-after-equations ---
$i$'s $i$ 's