BearToCode / carta

A lightweight, fast and extensible Svelte Markdown editor and viewer.
https://beartocode.github.io/carta/
MIT License
460 stars 20 forks source link

[plugin-emoji] several of the gemoji shortcodes don't render #86

Closed warren-bank closed 4 months ago

warren-bank commented 4 months ago

examples:

:snow_cloud:
:snowman_without_snow:
:snow_capped_mountain:

At first, I assumed the _ underscore character was the culprit, but that's not the case. Other codes having an underscore do work. Is it possible that the list of available codes is different from the set of codes that are actually supported by the renderer?

Your github example demos this behavior.

warren-bank commented 4 months ago

I don't think this is related, but it's worth a quick note that.. the regex for gemoji syntax is different from the regex for the plugin grammar.

More likely to be related, the popup seems to use node-emoji.. a different library.. to display the list of available codes. If I'm reading this right, then it's probable that the two libraries support different sets of codes. If so, maybe they can be configured to normalize the set?


update:


I wonder.. if the plugin could:

  import emojilib from 'emojilib'
  import {gemoji} from 'gemoji'

  emojilib.lib = {}
  for (let gem of gemoji) {
    emojilib.lib[gem.names[0]] = {
      keywords: [
        ...gem.names,
        ...gem.tags
      ],
      char: gem.emoji,
      category: gem.category
    }
  }

update: ..guess not

warren-bank commented 4 months ago

simpler solution..

remark-emoji uses node-emoji (same as the popup), rather than gemoji

Not only will this normalize the set of supported emoji codes, but it also removes an unecessary redundant dependency. As an added benefit, it has some additional options that I would definitely enable. (ie: accessible, emoticon)

github-actions[bot] commented 4 months ago

:tada: This issue has been resolved in version @cartamd/plugin-emoji-v4.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: