Skip to content

Commit 8c7e4d7

Browse files
committedFeb 7, 2017
fix: rendering emojis
1 parent cbaee21 commit 8c7e4d7

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 2.0.3
22
### Bug fixes
3+
- fix: rendering emojis
34
- fix: css var polyfill
45

56
## 2.0.2

‎src/render.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function init () {
3939
renderer.code = function (code, lang = '') {
4040
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
4141

42-
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl.replace(/:/g, '__colon__')}</code></pre>`
42+
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
4343
}
4444
renderer.link = function (href, title, text) {
4545
if (!/:/.test(href)) {

‎src/util.js

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export const merge = Object.assign || function (to) {
160160

161161
export function emojify (text) {
162162
return text
163+
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, match => match.replace(/:/g, '__colon__'))
163164
.replace(/:(\w*?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
164165
.replace(/__colon__/g, ':')
165166
}

0 commit comments

Comments
 (0)