fix: markdownToHtml multiline bold — [\s\S] instead of dot
GLM outputs multi-line **bold** blocks in essays. The dot regex .+? does not match newlines, so multiline bold rendered as raw **.
This commit is contained in:
@@ -63,7 +63,7 @@ export function markdownToHtml(text) {
|
|||||||
|
|
||||||
// 4. Convert Markdown patterns → HTML tags
|
// 4. Convert Markdown patterns → HTML tags
|
||||||
text = text
|
text = text
|
||||||
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>') // **bold**
|
.replace(/\*\*([\s\S]+?)\*\*/g, '<b>$1</b>') // **bold** (multiline)
|
||||||
.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, '<i>$1</i>') // *italic* (not inside **)
|
.replace(/(?<!\*)\*(?!\*)(.+?)(?<!\*)\*(?!\*)/g, '<i>$1</i>') // *italic* (not inside **)
|
||||||
.replace(/~~(.+?)~~/g, '<s>$1</s>') // ~~strike~~
|
.replace(/~~(.+?)~~/g, '<s>$1</s>') // ~~strike~~
|
||||||
.replace(/\[(.+?)\]\((.+?)\)/g, '<a href="$2">$1</a>') // [link](url)
|
.replace(/\[(.+?)\]\((.+?)\)/g, '<a href="$2">$1</a>') // [link](url)
|
||||||
|
|||||||
Reference in New Issue
Block a user