-
Notifications
You must be signed in to change notification settings - Fork 527
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
Ampersand (&) not rendered correctly in Table Of Contents #529
Comments
I'm experiencing similar problems with apostraphes Markdown
Rendered TOC
Rendered H1
|
Hi there ! Sorry for the delay ! This is now fixed, thank you so much for reporting ! :-) |
Great, thank you! When are you planning on releasing the latest version of the gem? |
robin850++ thanks, very awesome! |
My pleasure ! :) I can't tell you for sure but I hope to release a new version of Redcarpet next week. |
Any updates on when that new version with this fix is going to be released? Thanks! |
@robin850 Any idea when there will be a new version released? It looks like the last release was December 2015. I'd be happy to help tag a new version. |
@robin850 I'm still having inconsistencies between what's generated in the TOC and the headers using Redcarpet 3.4.0. Here are some quick tests I did in the console: Redcarpet 3.3.4 toc = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC.new)
toc.render("# Test & Test\n\n#Test's and Tests")
=> "<ul>\n<li>\n<a href=\"#test-test\">Test & Test</a>\n</li>\n<li>\n<a href=\"#test-s-and-tests\">Test's and Tests</a>\n</li>\n</ul>\n"
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new({ autolink: true, tables: true, strikethrough: true, fenced_code_blocks: true, with_toc_data: true }), {})
markdown.render("# Test & Test\n\nBody\n\n#Test's and Tests")
=> "<h1 id=\"test-amp-test\">Test & Test</h1>\n\n<p>Body</p>\n\n<h1 id=\"test-39-s-and-tests\">Test's and Tests</h1>\n" Redcarpet 3.4.0 toc = Redcarpet::Markdown.new(Redcarpet::Render::HTML_TOC.new)
toc.render("# Test & Test\n\n#Test's and Tests")
=> "<ul>\n<li>\n<a href=\"#test\">Test & Test</a>\n</li>\n<li>\n<a href=\"#test-s-and-tests\">Test's and Tests</a>\n</li>\n</ul>\n"
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new({ autolink: true, tables: true, strikethrough: true, fenced_code_blocks: true, with_toc_data: true }), {})
markdown.render("# Test & Test\n\nBody\n\n#Test's and Tests")
=> "<h1 id=\"test-test\">Test & Test</h1>\n\n<p>Body</p>\n\n<h1 id=\"tests-and-tests\">Test's and Tests</h1>\n" |
Thank you for this excellent piece of open source software and all of the time you put into it. I think I might have found a small bug I just wanted to file. I looked at fixing it and submitting a PR, but the Markdown rendering is beyond me.
The problem: When an ampersand character is present in a title, the
Redcarpet::Render::HTML_TOC
renderer converts the ampersand to "amp", but theRedcarpet::Render::HTML
renderer removes the ampersand character. Because the 2 value don't match up, clicking the TOC link fails and doesn't direct you to the correct spot on the page.For now I am working around it by changing &'s in titles to "and". Another workaround I found was changing &'s to &'s, but I found that that was a less clear workaround.
My Code
The Markdown
Rendered Table Of Contents
Rendered H2 Output
Maybe this will help somebody else, or inform you on development. Thanks again for the time you put into redcarpet, I love it.
The text was updated successfully, but these errors were encountered: