fix: rendering emojis

This commit is contained in:
qingwei.li 2017-02-07 20:17:12 +08:00
commit 8c7e4d7866
3 changed files with 3 additions and 1 deletions

View file

@ -160,6 +160,7 @@ export const merge = Object.assign || function (to) {
export function emojify (text) {
return text
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, match => match.replace(/:/g, '__colon__'))
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
.replace(/__colon__/g, ':')
}