Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
if (!(window.console && window.console.log)) {
return;
}
var emojiMap = {
':tada:': '🎉',
':smile:': '😊',
':rocket:': '🚀',
':fire:': '🔥'
// Add more emojis as needed
};

log = function() {
var args;
Expand Down Expand Up @@ -59,6 +66,17 @@
styles: function(match) {
return [match[1], ''];
}
},
{
// New emoji format
regex: /:([a-zA-Z0-9_-]+):/g,
replacer: function(m, p1) {
return emojiMap[`:${p1}:`] || m;
},
styles: function() {
return [];
}

}
];

Expand Down
5 changes: 5 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
log.l('%cred %cand %c[blue]', 'color: red', '', 'color: blue');
log.l('Result:');
log("[c=\"color:red\"]red[c] and [c=\'color:blue\'][blue][c]");

testHeader();
log('This is *italic* with :smile:'); // Outputs: This is italic with 😊
log('Bold _text_ and :rocket:'); // Outputs: Bold text and 🚀
log('Styled [c="color: red"]red[c] with :fire:'); // Outputs: red (in red) with 🔥
</script>
</head>
<body>
Expand Down