From 8c7e4d7866049db20871624140640e08dc5f55b7 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Tue, 7 Feb 2017 20:17:12 +0800 Subject: [PATCH] fix: rendering emojis --- CHANGELOG.md | 1 + src/render.js | 2 +- src/util.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c17150d..74b302250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 2.0.3 ### Bug fixes +- fix: rendering emojis - fix: css var polyfill ## 2.0.2 diff --git a/src/render.js b/src/render.js index 36b8cf672..a01fc9604 100644 --- a/src/render.js +++ b/src/render.js @@ -39,7 +39,7 @@ export function init () { renderer.code = function (code, lang = '') { const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup) - return `
${hl.replace(/:/g, '__colon__')}
` + return `
${hl}
` } renderer.link = function (href, title, text) { if (!/:/.test(href)) { diff --git a/src/util.js b/src/util.js index c57bb42f8..d5b62aeae 100644 --- a/src/util.js +++ b/src/util.js @@ -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, '$1') .replace(/__colon__/g, ':') }