
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@hackmd/emojify.js
Advanced tools
Note: This fork is a rewrite version from joypixels/emojify.js with TypeScript and up-to-date dependencies.
Below is the original README
A swiss-army-knife for all emoji, in Javascript. Used by Gitter and Mapbox.
The emoji keywords are as described by emoji-cheat-sheet.com.
:) :( :'(
img
, sprites and data-URI.htaccess
file for caching Javascript and CSSnpm install @hackmd/emojify.js --save
This works in the browser and on Node
object
- Optional JSON object with any of the following attributes:Option | Default | Description |
---|---|---|
blacklist.elements | ['script', 'textarea', 'a', 'pre', 'code'] | An array of elements you don't want emojified |
blacklist.classes | ['no-emojify'] | An array of classes you don't want emojified |
mode | img | By default, emojify will output an img with a src attribute for each emoji found. But if mode is set to sprite or data-uri , then span s with classes are outputted. Don't forget to include the appropriate CSS for your choice though, see the /dist directory. |
tag_type | null | When set, emojify uses this element with the class emoji emoji-#{emojiname} instead of an img with a src attribute. Example valid values: div , span . This takes precedence over the mode option. Note: if you're not using img s, .emoji-+1 isn't a valid class, so .emoji-plus1 is used instead. |
only_crawl_id | null | [DEPRECATED] Restricts searching for emojis to a specified element & it's children. If null, and no object is passed to run() , document.body is used |
img_dir | 'images/emoji' | Defines the path to the emoji images |
ignore_emoticons | false | If true , only convert emoji like :smile: and ignore emoticons like :) |
emojify.setConfig({tag_type : 'div'});
This works in the browser and Node
element
- Optional HTML element to restrict the emojification to.replacer
- Optional Function to override emoji replacement behaviour with your own. The function will receive two arguments, the emoji pattern found (emoji
), and the emoji name (name
). In the case of emoticons, for example, emoji = ':)'
and name = 'smile'
. Your function must return a HTMLElement.emojify.run();
// OR
emojify.run(document.getElementById('my-element'))
// OR
emojify.run(null, function(emoji, emojiName){
var span = document.createElement('span');
span.className = 'emoji emoji-' + emojiName;
span.innerHTML = emoji + ' replaced';
return span;
});
Requires you to have jsdom installed:
npm i jsdom --save
var jsdom = require('jsdom')
jsdom.env({
html: "<p><code>jhhh</code><em>:)</em></p>",
done: function(errors, window) {
emojify.run(window.document.body)
}
});
This works in the browser and on Node
string
- String to emojifycallback
- Optional callback function to output emoji withBy default, emojify.js uses the internal function defaultReplacer()
to replace emoji. You can override this behaviour by supplying your own callback function.
Your callback function will receive two arguments, the emoji pattern found (emoji
), and the emoji name (name
). In the case of emoticons, for example, emoji = ':)'
and name = 'smile'
.
The context in which your replacer function is run will have the config available. So you can access properties such as img_dir
at this.config.img_dir
.
emojify.replace('I am happy :)');
// OR
replacer = function(emoji, name) {
// Customise output here
return emojifiedString;
}
emojify.replace('I am happy :)', replacer);
Please read CONTRIBUTING.md.
Please read LICENSE.md. For image attributions, please read LICENSE-IMAGES.md
FAQs
A Javascript module to convert emoji keywords to images.
The npm package @hackmd/emojify.js receives a total of 141 weekly downloads. As such, @hackmd/emojify.js popularity was classified as not popular.
We found that @hackmd/emojify.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.