jaspervdj/hakyll

pandocCompiler flipping smart quotes in HTML in wrong direction after upgrade to Hakyll 4.15

charukiewicz opened this issue · 7 comments

Hello, I recently upgraded my Hakyll project to 4.15 and noticed that when I rebuild my site, I notice that there are situations where smart quotes are flipped to be angled incorrectly in the built HTML. Here's an example:

The file in question contains the following HTML (note the absence of smart quotes—everything uses regular, non angled quotes):

<p>Foxhound Systems, LLC ("we" or "us" or "our") respects the privacy of our users ("user" or "you"). 
This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you
visit our website <a href="/">www.foxhound.systems</a>, including any other media form, media
channel, mobile website, or mobile application related or connected thereto (collectively, the "Site").
Please read this privacy policy carefully. If you do not agree with the terms of this privacy policy, 
please do not access the site.</p>

This file is built using pandocCompiler, which handles the conversion of the smart quotes. With that in mind, here's the diff when building 4.14 versus 4.15:

smartquotes-hakyll-4 15

In case it isn't visible in the diff screenshot, here's the 4.14 text:

Foxhound Systems, LLC (“we” or “us” or “our”)

and here's the 4.15 text:

Foxhound Systems, LLC (”we” or “us” or “our”)

This is displayed on the page as:

Screenshot from 2022-03-25 22-40-51

Seemingly this is caused by the parentheses character "(" before the quote, which causes the compiler to build the quote in the wrong direction.

Has anyone experienced this issue? The simple fix is turning smart quotes off entirely by disabling Ext_smart using pandocReaderWith. I realize this may be an upstream issue with pandoc, but I figure that it makes sense to ask here first.

I don't observe this when building my site (https://github.com/Minoru/blog.debiania.in.ua) with Stack LTS 19.0 (hakyll 4.15.1.1, pandoc 2.17.1.1). I don't think Hakyll does anything with smart quotes, so yeah, I'd try to prepare a minimal example that shows the problem and post that to Pandoc's issue tracker.

Oh, one other thing you could try is building with different versions of Pandoc:

$ cabal build --constrain 'pandoc == 2.11`

This could help you pinpoint the Pandoc version where the problem appeared. (Ditto for Hakyll, but as I already said, I don't believe the problem here is with Hakyll.)

Hey @charukiewicz, did any of above suggestions help?

Hey @Minoru. Thanks for the suggestion. Looks like switching back to 2.11 does revert the smart quote direction to face the correct way. See screenshot below (red/top is pandoc version 2.14.0.3, bottom/green is with pandoc == 2.11).

Screenshot from 2022-04-29 15-22-22

Cool! Please report this to https://github.com/jgm/pandoc/issues then. Either it's a regression in Pandoc, or a change that we have to deal with by passing some option into Pandoc when we invoke it.

It looks like jgm/pandoc#8052 confirmed that this is caused by Pandoc, not Hakyll, so I'm closing this.