markdown-it / markdown-it-emoji

Emoji syntax plugin for markdown-it markdown parser
https://markdown-it.github.io/
MIT License
719 stars 167 forks source link

Add option to black list emojies #30

Closed aviadl closed 6 years ago

aviadl commented 6 years ago

@puzrin is there a chance to review and merge this?

puzrin commented 6 years ago

I don't like idea to extend API, if you can reach the same effect with existing one.

Would prefer to reject PR, but may be you could explain why this new option is super awesome.

aviadl commented 6 years ago

@puzrin not sure how can i get the same result with existing API. My problem is that i want all the great emojies accept one that gives me problems. Couldn't find another way to do it, but would be happy to learn

puzrin commented 6 years ago

All data files are available separate, to allow modifications. Just load content, filter by your needs and pass to options.

puzrin commented 6 years ago

https://github.com/markdown-it/markdown-it-emoji/blob/master/index.js#L4

let data_to_filter = require('markdown-it-emoji/lib/data/full.json');
aviadl commented 6 years ago

You are right, we managed to make it work But now instaed of:

...
plugins: [
  (md) => { emoji(md, { disabled: ['ab'] }); }
]
...

I need

import emojiesDefs from 'markdown-it-emoji/lib/data/full.json';
delete emojiesDefs.ab;
const enabledEmojies = Object.keys(emojiesDefs);
...
plugins: [
  (md) => { emoji(md, { enabled: enabledEmojies }); }
]
...

Looks more hacky to me, but it is your call

puzrin commented 6 years ago

Closing then. Let's keep api simple.