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

GFM parser: option to disable typographic symbol conversion #462

Closed
wants to merge 1 commit into from

Conversation

kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Oct 17, 2017

With GFM, we want to be as close as possible to GitHub Flavored Markdown. In particular, GitHub does not replace -- with en-dash, --- with em-dash et cetera, and doing this not only breaks HTML rendering (resulting in, say, –option instead of --option), but also makes header IDs incompatible with those generated by GitHub. So, let's turn automatic typographic symbol conversion by default, and add an option to enable it back.

I have checked that this change makes header IDs the same as they are in GitHub.

For more details on the issue and examples, see #459

Signed-off-by: Kir Kolyshkin kolyshkin@gmail.com

@gettalong
Copy link
Owner

Thanks for your pull request!

Some comments:

  • Please use the "gfm_quirks" configuration option instead of introducing a new one.
  • The default value should not change, i.e. this quirk should not automatically applied.

@kolyshkin
Copy link
Contributor Author

  • Please use the "gfm_quirks" configuration option instead of introducing a new one.
  • The default value should not change, i.e. this quirk should not automatically applied.

Done. I have two concerns though:

  1. It looks like the value of gfm_quirks is not validated. Is it intentional (i.e. non-recognized options are silently ignored)? To my mind, it would make sense to have at least a warning printed, to figure out a typo or, say, an old version of parser where a specific option is not recognized.

  2. If this option/quirk is not enabled by default, we still have those two problems that I described in the [GFM] wrong ID generation for headers containing -- #459. Isn't it your intention to make GFM parser as compatible with GFM as possible?

With GFM, we want to be as close as possible to GitHub Flavored
Markdown. In particular, GitHub does not replace -- with en-dash,
--- with em-dash et cetera, and doing this not only breaks
HTML rendering (resulting in, say, –option instead of --option).

The above replacement also makes header IDs incompatible with those
generated by GitHub, making it way harder to create a document
with intralinks that work both on GitHub and kramdown-generated
HTML.

So, let's introduce another GFM quirk to turn off automatic
typographic symbol conversion. NOTE it is off by default, i.e.
needs to be explicitly enabled.

For more details on the issue and examples, see
gettalong#459

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin changed the title GFM parser: no default typographic symbol conversion GFM parser: option to disable typographic symbol conversion Oct 19, 2017
@gettalong
Copy link
Owner

Thanks for the changes! As for your concerns:

  1. Yes, this is intentional so that custom parsers/converter can reuse the option.

  2. Full compatibility with GFM will not be possible, at first because there was no spec and now because it is based on CommonMark. Therefore having this as option is preferable.

@gettalong
Copy link
Owner

I have cherry-picked your commit - the changes will be in the next 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

Successfully merging this pull request may close these issues.

None yet

2 participants