Skip to content

Commit 4503cfc

Browse files
committed
fix: reserve '*' and '_' when detecting escape char '\' (close: #544).
1 parent e052c2a commit 4503cfc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/util/parseHeaders.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ const removeMarkdownToken = str => String(str)
1616
.replace(/`(.*)`/, '$1') // ``
1717
.replace(/\[(.*)\]\(.*\)/, '$1') // []()
1818
.replace(/\*\*(.*)\*\*/, '$1') // **
19-
.replace(/\*(.*)\*/, '$1') // *
20-
.replace(/_(.*)_/, '$1') // _
19+
.replace(/\*(.*[^\\])\*/, '$1') // *
20+
.replace(/_(.*[^\\])_/g, '$1') // _ _
21+
.replace(/(\\)(\*|_)/g, '$2') // remove escaped char '\'
2122

2223
exports.removeTailHtml = (str) => {
2324
return String(str).replace(/<.*>\s*$/g, '')

0 commit comments

Comments
 (0)