zerodevx / zero-md

Ridiculously simple zero-config markdown displayer
https://zerodevx.github.io/zero-md/
ISC License
437 stars 48 forks source link

github markdown emoji #106

Closed losciur closed 6 months ago

losciur commented 8 months ago

Hi, actually, github markdown emoji (https://gist.github.com/rxaviers/7360908) are not working for me.

Is it correct?

Do you think to add emoji in future release?

Thanks for you work!

zerodevx commented 8 months ago

Use the marked-emoji extension.

<head>
  ...
  <script type="module">
    import ZeroMd from 'https://cdn.jsdelivr.net/npm/zero-md@next'
    import { markedEmoji } from 'https://cdn.jsdelivr.net/npm/marked-emoji@1/src/index.js'
    import { Octokit } from 'https://esm.sh/@octokit/rest'

    const octokit = new Octokit()
    const res = await octokit.rest.emojis.get()
    const emojis = res.data

    customElements.define(
      'zero-md',
      class extends ZeroMd {
        async load() {
          await super.load()
          this.marked.use(markedEmoji({ emojis, unicode: false }))
        }
      }
    )
  </script>
</head>
<body>
  ...
  <zero-md src="example.md></zero-md>
</body>
zerodevx commented 6 months ago

Closing for now, feel free to reopen.

losciur commented 6 months ago

Sorry I forgot to reply... all is working! Thanks!