Skip to content
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

Support for GitHub markdown emojis #448

Closed
KirkMunro opened this issue Oct 23, 2017 · 6 comments
Closed

Support for GitHub markdown emojis #448

KirkMunro opened this issue Oct 23, 2017 · 6 comments
Assignees
Labels
enhancement PR: request-changes This PR needs additional changes

Comments

@KirkMunro
Copy link

GitHub markdown emojis are not supported in showdownjs.

For example:

💡 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.

@tivie tivie self-assigned this Oct 24, 2017
@tivie tivie added enhancement PR: request-changes This PR needs additional changes labels Oct 24, 2017
@tivie
Copy link
Member

tivie commented Oct 24, 2017

@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;👨

@tivie tivie closed this as completed in 5b8f1d3 Oct 24, 2017
@tivie
Copy link
Member

tivie commented Oct 24, 2017

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.

@KirkMunro
Copy link
Author

Wow, that was fast. Thanks @tivie!

@stupidpupil
Copy link

stupidpupil commented Dec 25, 2017

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.

@stupidpupil
Copy link

stupidpupil commented Dec 25, 2017

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.

@tivie
Copy link
Member

tivie commented Dec 25, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PR: request-changes This PR needs additional changes
Projects
None yet
Development

No branches or pull requests

3 participants