kramdown icon indicating copy to clipboard operation
kramdown copied to clipboard

HTML entities in hyperlink text

Open SomeWeekendReading opened this issue 3 years ago • 2 comments

I'm using kramdown as the default markdown engine in jekyll. Normally it renders entities correctly, even obscure ones like the capital Greek digamma (Ϝ which in some fonts looks vaguely like a Roman capital F). However, when the Ϝ is part of a link, it does not.

Example input: spirit of ϜΤΦ HTML output: spirit of ϜΤΦ

Note here that it has output the Τ and Φ entities as characters, but has escaped the ampersand in Ϝ causing it not to render.

Live example on the web here, near the bottom of the page.

Is jekyll perhaps using an older version by default?

SomeWeekendReading avatar Mar 29 '21 01:03 SomeWeekendReading

The reason for this is that the Gammad entity is not recognized by kramdown. I will fix this for the next release.

In the meantime you can do the following:

require 'kramdown/utils'
Kramdown::Utils::Entities::ENTITY_TABLE << [988, 'Gammad']

This adds the entity to the table where kramdown looks it up.

gettalong avatar Mar 29 '21 13:03 gettalong

Thanks; that makes sense. Maybe pick up all the legal HTML entities, if any others are missing?

SomeWeekendReading avatar Mar 30 '21 01:03 SomeWeekendReading