Giter VIP home page Giter VIP logo

emoji-for-jekyll's Introduction

Emoji for Jekyll

Seamlessly enable emoji for Jekyll.

Installation

  1. Install the emoji_for_jekyll gem:

     gem install emoji_for_jekyll
    
  2. Add emoji_for_jekyll to the list of gems in config.yml:

gems: ["emoji_for_jekyll"]
  1. See beautiful emoji!

or

  1. Copy emoji_for_jekll.rb and emoji.json into the _plugins directory

GitHub Pages

This plugin (and as a matter of fact, most Jekyll plugins) do not work with GitHub Pages as GitHub (understandably) do not allow arbitrary code to be executed on their servers. As a result, only selected plugins work with GitHub pages.

Here are my suggestions if you are using GitHub Pages:

  1. Build your site locally and push the content of _site.

  2. Use Jemoji.

Options

Whitelist and blacklist

You can also whitelist or blacklist certain emojis. On the posts or pages that you want to whitelist or blacklist certain emojis, add emoji-whitelist or emoji-blacklist follow by a list of emojis without the colons to the front matter. For example:

emoji-whitelist:
  - bowtie
  - blush

or

emoji-blacklist:
  - smile

When both emoji-whitelist and emoji-blacklist are declared, the effect will be the same as when only the whitelist is declared.

Disabling

You may choose to disable this plugin for certain posts or pages by adding emoji: false to the front matter of these posts and pages.

If, for some reason, you want to disable this plugin for the entire site, you can either remove emoji-for-jekyll.rb from _plugins, or just add emoji: false to _config.yml.

Emojify front-matter items

If you need to emojify certain items in your front-matter, like title or caption that is needed for some templates, you can do so by setting emoji-additional-keys in _config.yml. This setting is optional and expects an array:

emoji-additional-keys: ["title", "caption"]

Custom images

By default the images are sourced from GitHub CDN but should you want to use other images you can by choosing a directory with the setting emoji-images-path in _config.yml. For example: emoji-images-path: 'img/emoji'

Images copied into this directory will be added the whitelist. E.g.: custom.png would whitelist :custom:. Any images with the same name as the emoji list will overwrite the default GitHub emoji image.

Updating Emoji for Jekyll

Updating Emoji for Jekyll is very easy:

gem update emoji_for_jekyll

emoji-for-jekyll's People

Contributors

bitdeli-chef avatar prettymuchbryce avatar yihangho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

emoji-for-jekyll's Issues

How to call in another plugin?

Hi,

I'm new to Ruby. Just curious how to call this plugin from another plugin? I'd like to apply your code to a string of markdown text.

Thanks!

Won't parse emoji

Hello,

I placed emoji_for_jekyll.rb and emoji.json into _plugins.
In _config.yaml I added emoji: true. In a post I edited the text and added :smile: into it. When using jekyll build then it gets not changed to a img element.
What am I doing wrong?
I am using the latest version of that plugin from here and jekyll is version jekyll 3.1.6.

You can view the page at: https://github.com/wirehack7/capsop.com

baseurl missing for local emoji

My blog isn't located at the root of my webspace but in a subdirectory. So I've set the baseurl accordingly in my _config.yml.
After installing your plugin and trying to use emoji from a local directory instead of including them from GitHub I've noticed that the plugin correctly found the image files in the local directory but generated the wrong URL for the img-tags: The baseurl-part of the URL was missing.
Adding the baseurl to emoji-images-path didn't work either as the look up of the local image files failed that way.

As a start here's my quick&dirty patch:

diff --git a/_plugins/emoji_for_jekyll.rb b/_plugins/emoji_for_jekyll.rb
index 39eb05d..1d0f04b 100644
--- a/_plugins/emoji_for_jekyll.rb
+++ b/_plugins/emoji_for_jekyll.rb
@@ -38,7 +38,7 @@ module EmojiForJekyll
         Dir.foreach(images_dir) do |image_filename|
           if /^(?<tag>.*)\.(?:svg|png|jpg|jpeg|gif)/ =~ image_filename
             @master_whitelist << tag
-            @images_path[tag] = File.join("/", images_path, image_filename)
+            @images_path[tag] = File.join("/", site.config["baseurl"], images_path, image_filename)
           end
         end

This solved the problem for me but obviously needs some additional checking if baseurl exists at all.

Sorry for not just providing a merge request with a final solution, but I don't really know Ruby and just don't want to deliver a botched C++-style solution. ๐Ÿ˜‰

Issues with Github?

Copied over *rb and json to _plugins. Works locally but not on prod. My site is deployed on github.

Documentation unclear

HI, could you please provide some examples of syntax for integrating the emojis in blog text?

deprecation warning

Deprecation: Collection#each should be called on the #docs array directly.
Called by /Users/Vikram/Documents/code/vikram/blog/_plugins/emoji_for_jekll.rb:23:in `generate'.

no rendering into collections

hi @yihangho
I'm using your pluggin with jekyll and it's fun.
It works fine for rendering pages at the root of my site and also into posts.
But seems not working with pages in collections, something to do ?

regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.