Skip to content

Commit d88cac9

Browse files
committed
fix markdown
1 parent 4c469ae commit d88cac9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib/helpers/http.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,12 @@ export function replaceNewLine(text) {
9595
* @returns string
9696
*/
9797
export function replaceMarkdown(text) {
98-
return text.replace(/#([\s]*)/g, '\\# ').replace(/\*([\s]*)/g, '\\* ');
98+
let res = text.replace(/#([\s]+)/g, '\\# ');
99+
100+
let regex = new RegExp('\\*(.*?)\\*', 'g');
101+
if (!regex.test(text)) {
102+
res = res.replace(/\*([\s]*)/g, '\\* ');
103+
}
104+
105+
return res;
99106
}

0 commit comments

Comments
 (0)