Skip to content

Commit

Permalink
⬆️ 2.0.0 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Apr 10, 2020
1 parent bcaba17 commit 64a1151
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 527 deletions.
15 changes: 13 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@
const emojer = require("emojer")
, emojis = require("github-api-emojis/lib/map")

module.exports = function showdownEmoji () {
/**
* showdownEmoji
* Replace the :emojis: in the text with images.
*
* @name showdownEmoji
* @function
* @param {String} emojiDirPath The public path to
* the emoji directory containing the emoji images.
* @returns {Array} The configuration used by Showdown.
*/
module.exports = function showdownEmoji (emojiDirPath = "/emojis") {
const emojiImgTemplate = `<img src=\"${emojiDirPath}/__EMOJI_NAME__.png?v5\" alt=\":__EMOJI_NAME__:\" title=\":__EMOJI_NAME__:\" class=\"emoji-img emoji\">`
return [
{
type: "output"
, filter: text => emojer(text, "<img src=\"https://github.global.ssl.fastly.net/images/icons/emoji/__EMOJI_NAME__.png?v5\" alt=\":__EMOJI_NAME__:\" title=\":__EMOJI_NAME__:\" class=\"emoji-img emoji\">", emojis)
, filter: text => emojer(text, emojiImgTemplate, emojis)
}
]
}
Loading

0 comments on commit 64a1151

Please sign in to comment.