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

Converting Straight-Quotes Discourages Future Processing #287

Closed
fredleblanc opened this issue Feb 11, 2015 · 6 comments
Closed

Converting Straight-Quotes Discourages Future Processing #287

fredleblanc opened this issue Feb 11, 2015 · 6 comments
Milestone

Comments

@fredleblanc
Copy link

The inlineSpecialCharacter method is replacing " characters with " characters, but this is limits how the output is processed through other text modifiers. Mainly, in my case, running the text through SmartyPants. Because straight double-quotes are entities, SmartyPants won't process them into "smart" curly quotes.

I know that converting " into " isn't really a bug, it's more a feature that's getting in my way for later. I guess my question is — how necessary is this conversion to an entity for the rest of the code? Is other code relying on straight-double-quotes already being escaped?

@hkdobrev
Copy link
Contributor

@fredleblanc You could try writing a simple extension which would not do that for you.

@fredleblanc
Copy link
Author

@hkdobrev Absolutely! Please don't get me wrong, I'm not saying I don't want to do the work, I was more just hoping for advice about the rest of the internals. From early testing nothing seems to break, but I didn't know if there was a known "oh, that has to be done or else this won't work" thing I wasn't seeing.

@hkdobrev
Copy link
Contributor

@fredleblanc I don't think there would be a problem. If you make something good and generic you could add it to the wiki to help others! https://github.com/erusev/parsedown/wiki/Writing-Extensions

@robinadr
Copy link

robinadr commented Mar 1, 2015

I ran into this recently while making a Parsedown wrapper for WordPress. WP already does HTML special chars and curly quotes on its own, so Parsedown converting " to " messed this up.

This is how I disabled this functionality, for anyone interested:

class Parsedown_WP_Parser extends ParsedownExtra
{
    protected function inlineSpecialCharacter( $excerpt )
    {
        // Do nothing. WordPress handles HTML special characters
        // and curly quotes by default.
    }
}

This is easy to fix on your own, but I wonder if converting " is even a part of what a Markdown processor should do. Thoughts?

@fredleblanc
Copy link
Author

I ended up doing something similar on my end. Although I share the opinion that I wouldn't have a markdown processor handle this by default, I also understand that this decision certainly lives in the opinion district of opinionated software, and I respect that. (I tend to think that opinionated software is the best software.)

And as you've pasted, my code being similar, it's easy enough to "undo" if you don't want it.

On Mar 1, 2015, at 6:49 PM, Robin Adrianse notifications@github.com wrote:

I ran into this recently while making a Parsedown wrapper for WordPress. WP already does HTML special chars and curly quotes on its own, so Parsedown converting " to " messed this up.

This is how I disabled this functionality, for anyone interested:

class Parsedown_WP_Parser extends ParsedownExtra
{
protected function inlineSpecialCharacter( $excerpt )
{
// Do nothing. WordPress handles HTML special characters
// and curly quotes by default.
}
}
This is easy to fix on your own, but I wonder if converting " is even a part of what a Markdown processor should do. Thoughts?


Reply to this email directly or view it on GitHub.

@aidantwoods
Copy link
Collaborator

This should no longer occur in the next release, more info in #573 and the related PR.

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

4 participants