Skip to content
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

Closed
palant opened this issue May 9, 2020 · 8 comments
Closed

Typographer incorrectly processes apostrophes next to punctuation #127

palant opened this issue May 9, 2020 · 8 comments

Comments

@palant
Copy link

palant commented May 9, 2020

  1. What version of goldmark are you using? :
    1.1.25 (via Hugo v0.68.3/extended)

  2. What version of Go are you using?
    Presumably 1.12

  3. What operating system and processor architecture are you using?
    Ubuntu 20.04, x64

  4. What did you do?
    Render the text Yahoo!'s with typographer extension enabled.

  5. What did you expect to see?
    Yahoo!’s

  6. What did you see instead?
    Yahoo!‘s

  7. 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.

  8. 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.

@yuin
Copy link
Owner

yuin commented May 10, 2020

This is a limitation of the current algorithm. see #39 (comment)

@yuin yuin closed this as completed May 10, 2020
yuin added a commit that referenced this issue May 21, 2020
@yuin
Copy link
Owner

yuin commented May 21, 2020

I've tried to fix this in 3393022.
But I'm not familiar with English, Could you confirm whether this is fixed?

@palant
Copy link
Author

palant commented May 21, 2020

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.

@palant
Copy link
Author

palant commented May 21, 2020

I tested this on my blog contents. There are no side-effects but #128 isn't entirely fixed. reported "issue 1 (IE-only)" is processed correctly, reported "issue 1 (IE-only)", "issue 2" is not. Then again, comma belongs inside the quotation marks in English so maybe this isn't a concern.

yuin added a commit that referenced this issue May 22, 2020
@yuin
Copy link
Owner

yuin commented May 22, 2020

I've fixed the issue with very English specific way. So I'm not sure if this is correct...

@adiabatic
Copy link
Contributor

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.

Then again, comma belongs inside the quotation marks in English so maybe this isn't a concern.

In American English, yes; in British English, no.

@palant
Copy link
Author

palant commented May 23, 2020

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 <q> tags...

@yuin
Copy link
Owner

yuin commented May 23, 2020

It is very hard to implement a perfect typographer extension you know, I keep it a "simple English typographer" .
In terms of that, Typographer seems mostly working correctly. So I've made a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants