Showdown: Support for GitHub markdown emojis

Created on 23 Oct 2017  路  6Comments  路  Source: showdownjs/showdown

GitHub markdown emojis are not supported in showdownjs.

For example:

:bulb: IDEA: Since showdownjs has native GFM support, complete it by adding GFM emoji support to showdownjs!

Please consider adding this natively. I know there is an extension out there, but since GFM is supported natively this really should be there natively too.

enhancement request

Most helpful comment

Yeah, the culprits are showdown and octocat emojis.
Showdown emoji was a bit of vanityware.
It can be replaced with an SVG that will reduce the size considerably.
Or maybe remove them altogether.

All 6 comments

@KirkMunro Although I see your point, what's the downside of getting that functionality through an extension?

github way

As far as I can tell, github uses HTML5 custom elements for emojis:

:bulb: IDEA: Since showdownjs has native GFM support, complete it by adding GFM emoji support to showdownjs!
<p><g-emoji alias="bulb" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f4a1.png" ios-version="6.0">馃挕</g-emoji> IDEA: Since showdownjs has native GFM support, complete it by adding GFM emoji support to showdownjs!</p>

which won't work for showdown since it would end up generating non compliant HTML5.

Showdown way

So, if this feature is implemented, we would only replace :emoji-name: with the appropriate unicode character and without fallback option.

:bulb: IDEA: Since showdownjs has native GFM support, complete it by adding GFM emoji support to showdownjs!
<p>馃挕 IDEA: Since showdownjs has native GFM support, complete it by adding GFM emoji support to showdownjs!</p>

Problem

There are also a few github "non standard" emojis that have no unicode correspondence. Ex: :couplekiss_man_man: which translates to 馃懆&zwj;鉂わ笍&zwj;馃拫&zwj;馃懆

Feature implemented in 5b8f1d3 and should be released @ v1.8.0.


As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money. Currently, we're looking to improve showdown with automated tests in all browsers and a proper domain and webpage. 500$ should be enough to to keep showdown testing framework running for a year or two.

If you like our work and find our library useful, please donate through Pledgie or directly through paypal!! Your contribution will be greatly appreciated.

Wow, that was fast. Thanks @tivie!

Is it worth noting that this has a relatively large impact on the size of the library? The minimised version grows from around 40kB to 95kB (or 11kB to 32kB after gzipping).

It's not hard to strip this out if you're not interested in emoji-support and want to save the 20-40kB:

.replace(/showdown.helper.emojis = \{[\s\S]+?\};/, 'showdown.helper.emojis = {};');

works for me in a grunt-task, for example.

I bring it up only because it might surprise some people using Showdown client-side who find their javascript bundles growing by perhaps 10% or so, and one of Showdown's attractions has been that it's fairly slim.

Looks as though much of the increase (particularly post-gzip?) might be the special :showdown: 'emoji'. It might be possible to slim that down quite a bit by optimising the PNG.

Yeah, the culprits are showdown and octocat emojis.
Showdown emoji was a bit of vanityware.
It can be replaced with an SVG that will reduce the size considerably.
Or maybe remove them altogether.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andistuder picture andistuder  路  5Comments

jeud picture jeud  路  3Comments

subodhpareek18 picture subodhpareek18  路  5Comments

evanplaice picture evanplaice  路  3Comments

geudrik picture geudrik  路  7Comments