fix: correctly fix missing +1, -1 (#1722)

This commit is contained in:
ChoKaPeek 2022-01-14 10:56:28 +01:00 committed by GitHub
parent c1227b22cb
commit 719dcbea5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,11 +12,9 @@ function replace(m, $1) {
export function emojify(text) {
return text
.replace(/:\+1:/g, ':thumbsup:')
.replace(/:-1:/g, ':thumbsdown:')
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m =>
m.replace(/:/g, '__colon__')
)
.replace(/:(\w+?):/gi, (inBrowser && window.emojify) || replace)
.replace(/:([a-z0-9_\-\+]+?):/g, (inBrowser && window.emojify) || replace)
.replace(/__colon__/g, ':');
}