Open ashmaroli opened 2 years ago
I'm not sure where the problem is because of this:
$ kramdown
Some frac 1/2
^d
<p>Some frac 1/2</p>
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?
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.
There is no code in kramdown that converts 1/4, 1/2 and 3/4 to the corresponding fraction character.
Maybe a remnant of legacy code, but a quick repo-wide search on GitHub showed me the following lines:
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.
Is there a standardized list out there or are the integers assigned to the ENTITIES TABLE
arbitrarily?
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.