Skip to content

[GFM] wrong ID generation for headers containing -- #459

Closed

Description

@kolyshkin

Consider the following fragment of an .md file on github:

...
see [--foobar](#option---foobar) option below.
...
## Option --foobar

The above gets rendered by GitHub to the following:

...
see --foobar option below.
...

Option --foobar

Now, if we use kramdown GFM to convert this .md, we'll have the following two problems:

  1. Double dash gets replaced by ndash, which is bad at least in this particular case, and maybe in general, as GitHub's own parser doesn't do it.
  2. The link to "Option --foobar" will not work, as ID for the intralink will be option-foobar rather than github's option---foobar. The reason is the above double-dash -> ndash conversion.

While the first issue is only bad in some specific cases, the second one is really bad as it breaks some intralinks in the resulting document. Perhaps it makes sense to disable double-dash and triple-dash conversion for GFM (say, another option to gfm_quirks)?

Activity

  1. self-assigned this
    on Oct 11, 2017
  2. gettalong commented on Oct 11, 2017

    @gettalong
    Owner

    If we change the way link generation works for the GFM parser, it might break existing documents. However, since it is GFM we are talking about and the implementation in kramdown is not quite complete, I would consider such a change a bug fix and not a feature change.

    A pull request for this is welcome.

  3. kolyshkin commented on Oct 17, 2017

    @kolyshkin
    ContributorAuthor

    OK, I have a PR with a patch that apparently works. I'm just not sure about it as my Ruby knowledge is totally non-existent, to say at least.

  4. gettalong commented on Oct 26, 2017

    @gettalong
    Owner

    Pull request #462 is applied.

  5. added a commit that references this issue on Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions