We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 897332d + 8071f1a commit df9177fCopy full SHA for df9177f
src/lib/helpers/http.js
@@ -92,14 +92,16 @@ export function replaceNewLine(text) {
92
/**
93
* Replace unnecessary markdown
94
* @param {string} text
95
- * @returns string
+ * @returns {string}
96
*/
97
export function replaceMarkdown(text) {
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, '\\* ');
+
+ let regex1 = new RegExp('\\*(.*)\\*', 'g');
+ let regex2 = new RegExp('\\*([\\*]+)\\*', 'g');
103
+ if (!regex1.test(text) || regex2.test(text)) {
104
+ res = res.replace(/\*/g, '\\*');
105
}
106
107
return res;
0 commit comments