-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
Limited rendering of fraction entities #769
Comments
I'm not sure where the problem is because of this:
There is no code in kramdown that converts 1/4, 1/2 and 3/4 to the corresponding fraction character. Could you show what you did? |
My test script: require "kramdown"
list = []
(1..5).each do |i|
list << ((i+1)..9).to_a.map { |n| "&frac#{i}#{n};" }.join(", ")
end
puts Kramdown::Document.new(list.join("\n\n")).to_html
# pasting output here for readers' convenience (extra linefeed stripped for compactness):
#
# <p>½, &frac13;, ¼, &frac15;, &frac16;, &frac17;, &frac18;, &frac19;</p>
# <p>&frac23;, &frac24;, &frac25;, &frac26;, &frac27;, &frac28;, &frac29;</p>
# <p>¾, &frac35;, &frac36;, &frac37;, &frac38;, &frac39;</p>
# <p>&frac45;, &frac46;, &frac47;, &frac48;, &frac49;</p>
# <p>&frac56;, &frac57;, &frac58;, &frac59;</p> I then piped the output to an HTML file to see how the browser renders it.
Maybe a remnant of legacy code, but a quick repo-wide search on GitHub showed me the following lines: kramdown/lib/kramdown/converter/latex.rb Lines 449 to 451 in 0b0a9e0
|
Ah, thanks, now I understand. To support those other fractions, they need to be added to https://github.com/gettalong/kramdown/blob/master/lib/kramdown/utils/entities.rb#L210-L212. |
Ah I see. So it wasn't LaTeX getting involved somehow. |
See the description of the table - the number is the Unicode code point. |
Yes, I read the description comment after I had posted. But left my post unedited in case you had an URL to a standard reference so that future additions could be automated. |
No, sorry, I think I used a table from the HTML spec or Wikipedia. |
A Jekyll user brought to my notice that kramdown doesn't render fraction entities like other Markdown parsers (e.g. pandoc, Commonmarker, etc) do.
Local tests show that only ¼, ½ and ¾ are rendered whereas ⅓ (
⅓
), ⅔ (⅔
), ⅘ (⅘
) etc are not.The text was updated successfully, but these errors were encountered: