rhysd / remark-emoji

Remark markdown transformer to replace :emoji: in text
MIT License
124 stars 18 forks source link

Add emoticon support #11

Closed AWolf81 closed 4 years ago

AWolf81 commented 4 years ago

I'm working on a PR to Boostnote.next and there I'm using your plugin.

It's working but I'd like to have emoticon support. What do you think, is this something you'd like to add?

If you don't like it, no problem - I could also create a separate plugin for it. But I think it would be good to have it. Then it got similar features like retext-emoji as you can see in the following demo.

So what will be added? You can write :-) and it will be replaced with 😃. It's using emoticon for the shortcodes and icons.

The regex is matching every shortcode from index.json of emoticon as you can see here - the " and [ match is a bit confusing in the regex101 but it's working as the markdown is with-out these additional chars. (Just the key emoticons need to be matched.)

I've added some test cases. So it should be fully tested but please let me know if I've missed a case.

AWolf81 commented 4 years ago

@rhysd sure, no problem. I'll add it later today. The option requires some updates in unit test as well but I think it's a good idea to have this as optional feature.

If you like I can also create another PR to update the readme so this feature is documented.

rhysd commented 4 years ago

Thank you. Please ping me when you finish the work.

If you like I can also create another PR to update the readme so this feature is documented.

Yeah, that's helpful.

AWolf81 commented 4 years ago

@rhysd ping.