From 4503cfc044c6dba2af2da5d0021a91f1e921a3dd Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Mon, 4 Jun 2018 23:57:40 +0800 Subject: [PATCH] fix: reserve '*' and '_' when detecting escape char '\' (close: #544). --- lib/util/parseHeaders.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/util/parseHeaders.js b/lib/util/parseHeaders.js index 3837eeba39..58f6c41cc5 100644 --- a/lib/util/parseHeaders.js +++ b/lib/util/parseHeaders.js @@ -16,8 +16,9 @@ const removeMarkdownToken = str => String(str) .replace(/`(.*)`/, '$1') // `` .replace(/\[(.*)\]\(.*\)/, '$1') // []() .replace(/\*\*(.*)\*\*/, '$1') // ** - .replace(/\*(.*)\*/, '$1') // * - .replace(/_(.*)_/, '$1') // _ + .replace(/\*(.*[^\\])\*/, '$1') // * + .replace(/_(.*[^\\])_/g, '$1') // _ _ + .replace(/(\\)(\*|_)/g, '$2') // remove escaped char '\' exports.removeTailHtml = (str) => { return String(str).replace(/<.*>\s*$/g, '')