npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-filter-github-emojis-v2

v3.0.6

Published

A Hexo plugin that adds emojis support, using Github Emojis API

Downloads

17

Readme

hexo-filter-github-emojis

Npm Version Npm Downloads Month Npm Downloads Total License

A Hexo plugin that adds emoji support, using Github Emojis API.

Check out the Emoji Cheat Sheet for all the emojis it supports.

Installation

$ npm install hexo-filter-github-emojis --save

Options

You can configure this plugin in _config.yml. Default options:

githubEmojis:
  enable: true
  className: github-emoji
  inject: true
  styles:
  customEmojis:
  • enable boolean=true - Enable :: emoji parsing. If off the tag and helper still work.

  • className string="github-emoji" - Emoji class name.
    For example :sparkles: :sparkles: the filter will generate something like this:

    <span class="github-emoji"><span>&#x2728;</span><img src="https://assets-cdn.github.com/images/icons/emoji/unicode/2728.png?v8"></span>
  • inject boolean=true - Inject emoji styles and fallback script.
    If true, the filter will inject a <style> to the html.
    If false, the filter will not inject any style. If you can modify source style files you may turn this off and add them yourself.

    Below are the injected styles. The class name changes according to option.

    .github-emoji {
      position: relative;
      display: inline-block;
      width: 1.2em;
      min-height: 1.2em;
      overflow: hidden;
      vertical-align: top;
      color: transparent;
    }
    
    .github-emoji > span {
      position: relative;
      z-index: 10;
    }
    
    .github-emoji img,
    .github-emoji .fancybox {
      margin: 0 !important;
      padding: 0 !important;
      border: none !important;
      outline: none !important;
      text-decoration: none !important;
      user-select: none !important;
      cursor: auto !important;
    }
    
    .github-emoji img {
      height: 1.2em !important;
      width: 1.2em !important;
      position: absolute !important;
      left: 50% !important;
      top: 50% !important;
      transform: translate(-50%, -50%) !important;
      user-select: none !important;
      cursor: auto !important;
    }
    
    .github-emoji-fallback {
      color: inherit;
    }
    
    .github-emoji-fallback img {
      opacity: 0 !important;
    }
  • styles object={} - inline styles. For example:

    githubEmojis:
      styles:
        font-size: 2em
        font-weight: bold

    outputs:

    <span class="github-emoji" style="font-size:2em;font-weight:bold" ...>
  • customEmojis object={} - You can specify your own list. An object or JSON string is valid. The filter will first check the customEmojis then fallback to the Github Emojis list.

    For example:

    githubEmojis:
      customEmojis:
        arrow_left: https://path/to/arrow_left.png
        arrow_right: https://path/to/arrow_right.png

    If you need to add code points that are not in the Github list, you can do this:

    githubEmojis:
      customEmojis:
        man_juggling:
          src: https://path/to/man_juggling.png
          codepoints: ["1f939", "2642"]
        arrow_right: https://path/to/arrow_right.png

Tag

If you do not like the ::-style keywords, you can always use tags:

{% github_emoji sparkles %}

Add no-emoji: true to front-matter to stop replacing :::

---
title: Hello World
no-emoji: true
---

:tada: as it is.

{% github_emoji tada %} still works.

Helper

You can also render a GitHub emoji from a template using the github_emoji helper:

<h1><%- github_emoji('octocat') %></h1>

Fancybox

If you are using theme that enables fancybox(e.g. the default landscape theme) it is recommended to skip the github emoji imgs.

Edit themes/landscape/source/script.js

   // Caption
   $('.article-entry').each(function(i){
     $(this).find('img').each(function(){
       if ($(this).parent().hasClass('fancybox')) return;
+      if ($(this).parent().hasClass('github-emoji')) return;
 
       var alt = this.alt;
 
       if (alt) $(this).after('<span class="caption">' + alt + '</span>');
 
       $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
     });
 
     $(this).find('.fancybox').each(function(){
       $(this).attr('rel', 'article' + i);
     });
   });