@aaashur/eleventy-plugin-emoji-shortcodes
v1.0.2
Published
Transform emoji shortcodes to accessible elements
Downloads
8
Readme
eleventy-plugin-emoji-shortcodes
Transform emoji shortcodes to accessible elements.
For example, the following Markdown:
who called them “dad jokes” instead of “popcorn”? :drum:
would be rendered as:
<p>who called them “dad jokes” instead of “popcorn”? <span aria-label="drum" role="img">🥁</span></p>
Transformation happens after templates are rendered to HTML, so all Eleventy template syntaxes are supported.
See the gemoji project for details on supported shortcode strings.
Usage
To install this plugin, run the following command at the root of your Eleventy project:
npm install --save @aaashur/eleventy-plugin-emoji-shortcodes
Next, include the following in your Eleventy config file:
const emojiShortcodes = require("@aaashur/eleventy-plugin-emoji-shortcodes");
module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(emojiShortcodes);
};
Plugin Options
| Option | Type |
| :-- | :-- |
| class
| string |
To set a class name (or names), set the class
option when registering the plugin:
eleventyConfig.addPlugin(emojiShortcodes, { class: 'emoji' });
:popcorn:
<span aria-label="popcorn" role="img" class="emoji">🍿</span>