diff --git a/frontend/views/utils/markdown-utils.js b/frontend/views/utils/markdown-utils.js
index 41092a3ac..2de803596 100644
--- a/frontend/views/utils/markdown-utils.js
+++ b/frontend/views/utils/markdown-utils.js
@@ -37,12 +37,13 @@ export function renderMarkdown (str: string): any {
strSplitByCodeMarkdown.forEach((entry, index) => {
if (entry.type === 'plain' && strSplitByCodeMarkdown[index - 1]?.text !== '```') {
let entryText = entry.text
- entryText = entryText.replace(//g, '>')
+ entryText = entryText.replace(//g, '>') // Replace all '>' with '>' except for the ones that are not preceded by a line-break or start of the string (e.g. '> asdf' is a blockquote).
entryText = entryText.replace(/\n(?=\n)/g, '\n
')
- .replace(/
\n(\s*)(\d+\.|-)/g, '\n\n$1$2') // [1] custom-handling the case where
is directly followed by the start of ordered/unordered lists
- .replace(/(\d+\.|-)(\s.+)\n
/g, '$1$2\n\n') // [2] this is a custom-logic added so that the end of ordered/un-ordered lists are correctly detected by markedjs.
-
+ .replace(/
\n(\s*)(>|\d+\.|-)/g, '\n\n$1$2') // [1] custom-handling the case where
is directly followed by the start of ordered/unordered lists
+ .replace(/(>|\d+\.|-)(\s.+)\n
/g, '$1$2\n\n') // [2] this is a custom-logic added so that the end of ordered/un-ordered lists are correctly detected by markedjs.
+ .replace(/(>)(\s.+)\n
/gs, '$1$2\n\n') // [3] this is a custom-logic added so that the end of blockquotes are correctly detected by markedjs. ('s' flag is needed to account for multi-line strings)
entry.text = entryText
}
})