From 5023d195dcd7ee6d3710a43558940bcdc31d5a2f Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Mon, 30 Apr 2018 15:09:13 +0800 Subject: [PATCH] fix: title cannot be number at front matter (#297) --- lib/util/parseHeaders.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util/parseHeaders.js b/lib/util/parseHeaders.js index 8fbf18ac95..2a2c4fee4c 100644 --- a/lib/util/parseHeaders.js +++ b/lib/util/parseHeaders.js @@ -1,16 +1,16 @@ const parseEmojis = str => { const emojiData = require('markdown-it-emoji/lib/data/full.json') - return str.replace(/:(.+?):/g, (placeholder, key) => emojiData[key] || placeholder) + return String(str).replace(/:(.+?):/g, (placeholder, key) => emojiData[key] || placeholder) } -const unescapeHtml = html => html +const unescapeHtml = html => String(html) .replace(/"/g, '"') .replace(/'/g, '\'') .replace(/:/g, ':') .replace(/</g, '<') .replace(/>/g, '>') -const removeMarkdownToken = str => str +const removeMarkdownToken = str => String(str) .replace(/`(.*)`/, '$1') // `` .replace(/\[(.*)\]\(.*\)/, '$1') // []() .replace(/\*\*(.*)\*\*/, '$1') // **