Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ampersand in TOC still doesn't render correctly #696

Closed
enthusiasmus opened this issue Oct 12, 2020 · 1 comment
Closed

Ampersand in TOC still doesn't render correctly #696

enthusiasmus opened this issue Oct 12, 2020 · 1 comment
Labels

Comments

@enthusiasmus
Copy link

enthusiasmus commented Oct 12, 2020

Hi!

Thanks for this great gem!

The following test should succeed, but it doesn't. Instead of #main-bar the output contains only #main. One can use this test to implement the feature. Unfortunately my C skills are kind of rusty.

class HTMLTOCRenderTest < Redcarpet::TestCase
  ...
  def test_converting_ampersand_correctly
    markdown = "# Main & Headline"
    output = render(markdown)
    assert output.match("<a href=\"#main-bar\">Main & Headline</a>")
  end
end

Would be great!
Best regards,
Lukas

@robin850
Copy link
Collaborator

Hello @enthusiasmus,

Sorry for the late reply. Indeed, this was a bug on our side due to the fact that HTML entities are stripped out from the generated anchor so dealing with the & char requires an extra check. This should be fixed in the next Redcarpet release.

Thanks for reporting !

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

No branches or pull requests

2 participants