1.1.1 • Published 5 years ago

gatsby-remark-gemoji-to-image v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

gatsby-remark-gemoji-to-image

Build Status

Convert Github offcial gemoji to image element.

Installation

npm i gatsby-remark-gemoji-to-image

Usage

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          'gatsby-remark-gemoji-to-image',
        ]
      }
    }
  ]
}

Options

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: 'gatsby-remark-gemoji-to-image',
            // default options, can be ignored
            options: {
              base = 'https://github.githubassets.com/images/icons/emoji/',
              ext = '.png',
              class: ['emoji'],
              style = {
                height: '1.2em',
                display: 'inline',
                position: 'relative',
                top: '0.15em',
                margin: 0
              }
            }
          }
        ]
      }
    }
  ]
}

How it works?

:octocat:

Basically, it convert remark node's ast from

{
  type: 'text',
  value: ':octocat:',
  position: [...]
}

to

{
  type: 'image',
  title: ':octocat:',
  url: 'https://github.githubassets.com/images/icons/emoji/octocat.png',
  alt: ':octocat:',
  data: {
    hName: 'img',
    hProperties: {
      className: ['emoji'],
      style: {
        height: '1.2em',
        display: 'inline',
        position: 'relative',
        top: '0.15em',
        margin: 0
      }
    },
  },
  position: [...]
}
1.1.1

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago