jonschlinkert / remarkable

Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
https://jonschlinkert.github.io/remarkable/demo/
MIT License
5.74k stars 371 forks source link

Emoji feature design #62

Open aravindet opened 9 years ago

aravindet commented 9 years ago

I’d like to build the emoji feature. It will work similar to linkify or replace, so I’m thinking of adding it to the typographer. Comments?

Also, an option to let users switch between images and unicode in the output, and to specify the path prefix for loading images, will be needed. I suggest:

typographer.set({
  emojiFormat: 'png', // other options: gif, unicode
  emojiPath: '/emoji' // sample file name: /emoji/thumbsup.png
});

Is this okay?

puzrin commented 9 years ago

There are 2 possible ways:

All depends on priority you need to get. Both will work.

About options - you can leave typographer settings intact, and pass options directly to plugin on .use() call. Also, not principal.

In general, you understand right.

puzrin commented 9 years ago

Hm... may be i missed something. Do you wish to implement this as plugin or as core feature? List of emojy names is quite big, and will cause noticeable core grow. I think, it's better to do it as plugin. That's discussable.

puzrin commented 9 years ago

Note2:

  1. No need to use rendering options. We can't cover all cases anyway. It's better to render in unicode and let user rewrite renderer as he wish.
  2. It would be nice to cover smile aliases: :), :( and so on.
jonschlinkert commented 9 years ago

I’m thinking of adding it to the typographer. Comments?

my 2c is that a plugin would be best for this. Too big to add to the core. Would be awesome to see though!

puzrin commented 9 years ago

I think, these 2 params needed:

If not set - use defaults.

aravindet commented 9 years ago

Okay, I’ll explore making this a plugin. Sticking to unicode also seems to be a good idea.

Is there an example plugin somewhere that I can look at?

puzrin commented 9 years ago

Not yet, sorry. Something like this:

module.exports = function(md, options) {
  md.typographer.ruler.after(function emoji(...) { ... });
  md.renderer.rules.emoji = function (...) { ... };
}

For rule source take a look at linkifier, it does something similar - split text tokens and insert new one between.

jonathanong commented 9 years ago

going off on a tangent... if this is going to be a plugin that's not included in this repository, it would be great if both this repo and all its "official" plugins were in its own github organization. i love the contribution activity in this repo and hope to have it be consistent across all plugins.

jonschlinkert commented 9 years ago

yeah I agree, although I don't know yet if we plan on having official plugins - just haven't had time to think about it yet lol.

I was hoping to get the remarkable org when we started this, since there was no activity for over two years, then this month all of a sudden some commits happened. https://github.com/remarkable.

jonschlinkert commented 9 years ago

@jonathanong if you come up with ideas/names for an org, feel free to create an issue to get discussion going around it. not sure what @puzrin's thoughts are.

puzrin commented 9 years ago

I don't think that after we finish planned extentions from pending list, here remain big activity with zillions of plugins, like for grunt. All endless ass pain in other trackers is around the same things - broken rules / sub / sup / footnotes / abbrs / todos. Once been done 99% of problems disapper.

puzrin commented 9 years ago

I could include basic emojis support in core, by this principle:

So, couple questions to all:

  1. Will such reduced support be useful?
  2. Which icons do you really need, when asking emoji support?
  3. Does exists reduced list for such needs, anywhere?
  4. Are images available on some CDN with ssl support?

For example, 5-10 similes are enougth for my needs. But you can have different cases.

jonschlinkert commented 9 years ago

I love the idea of emojis, but I still think this is best as a plugin.

  1. as a plugin, users who need this can use it.
  2. it's a great example of a what a plugin can do
  3. if you still want to included it core, we could do it as a "core" plugin. the instructive value of this outweighs everything IMO
adam-lynch commented 9 years ago

A couple of good projects:

jonschlinkert commented 9 years ago

Twitter just open sourced: https://github.com/twitter/twemoji a few hours ago.

tomByrer commented 9 years ago

Twitter just open sourced: https://github.com/twitter/twemoji a few hours ago.

Nice, & hosted with MaxCDN!

I'd think translating MD into generic Unicode, then having an additional plugin to render the Unicode into what ever icon set is most flexible.

jonschlinkert commented 9 years ago

Agreed, it seems that every user will have different emoji they prefer using, so only full support will be satisfactory. so I love the idea of this being a plugin. Not sure if I or we have the bandwidth to officially support that though

puzrin commented 9 years ago

http://www.emoji-cheat-sheet.com/ - memo from wish list.

stephenlacy commented 9 years ago

@jonschlinkert Would you consider what we did with gulp? http://gulpjs.com/plugins/ https://github.com/gulpjs/plugins

jonschlinkert commented 9 years ago

@stevelacy absolutely! would love to