-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typographer incorrectly processes apostrophes next to punctuation #127
Comments
This is a limitation of the current algorithm. see #39 (comment) |
I've tried to fix this in 3393022. |
The tests look ok given my understanding of English (which isn't my first language either). I'll need to run it on a larger collection of texts to see whether it caused any side-effects. Maybe I can compile Hugo with this revision and see what changes. |
I tested this on my blog contents. There are no side-effects but #128 isn't entirely fixed. |
I've fixed the issue with very English specific way. So I'm not sure if this is correct... |
I'm a native English speaker. From what I understand, it's impossible to write a program that correctly curls quotes all the time. A programmer can only rely on heuristics and guesses.
In American English, yes; in British English, no. |
I checked out how Blackfriday solved this issue and it is also very English-specific. https://docutils.sourceforge.io/docs/user/smartquotes.html has some info on other languages and it isn't any less messy (from your tests it looks like you've seen this one already). So I guess the only real solution would be proper Markdown syntax producing |
It is very hard to implement a perfect typographer extension you know, I keep it a "simple English typographer" . |
What version of goldmark are you using? :
1.1.25 (via Hugo v0.68.3/extended)
What version of Go are you using?
Presumably 1.12
What operating system and processor architecture are you using?
Ubuntu 20.04, x64
What did you do?
Render the text
Yahoo!'s
with typographer extension enabled.What did you expect to see?
Yahoo!’s
What did you see instead?
Yahoo!‘s
Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?
The demo doesn't process apostrophes but Blackfriday (previous Hugo version) produced the correct output.
Why you can not implement it as an extension?
I could probably write a fix myself, but I'd need a confirmation about the approach first. In my understanding, an apostrophe should only be rendered as
‘
after whitespace.The text was updated successfully, but these errors were encountered: