mirror of
https://github.com/Aviortheking/codestats-readme.git
synced 2025-07-29 15:29:51 +00:00
feat(repocard): parse emojis in description (#67)
* feat: add remove_emojis option Removes emojis in repo card description * feat: parse emojis * feat: rename remove_emojis to show_emojis option for consistency * docs: update docs Co-authored-by: anuraghazra <hazru.anurag@gmail.com>
This commit is contained in:
@ -5,6 +5,7 @@ const {
|
||||
FlexLayout,
|
||||
} = require("../src/utils");
|
||||
const icons = require("./icons");
|
||||
const toEmoji = require("emoji-name-map");
|
||||
|
||||
const renderRepoCard = (repo, options = {}) => {
|
||||
const {
|
||||
@ -34,8 +35,14 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
const shiftText = langName.length > 15 ? 0 : 30;
|
||||
|
||||
let desc = description || "No description provided";
|
||||
|
||||
// parse emojis to unicode
|
||||
desc = desc.replace(/:\w+:/gm, (emoji) => {
|
||||
return toEmoji.get(emoji) || "";
|
||||
});
|
||||
|
||||
if (desc.length > 55) {
|
||||
desc = `${description.slice(0, 55)}..`;
|
||||
desc = `${desc.slice(0, 55)}..`;
|
||||
}
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
|
Reference in New Issue
Block a user