Merge pull request #5827 from ConnectAI-E/fix/markdown-embed-codeblock

fix: 代码块嵌入小代码块时渲染错误
This commit is contained in:
Lloyd Zhou 2024-11-15 16:03:27 +08:00 committed by GitHub
commit f22cec1eb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -248,6 +248,10 @@ function escapeBrackets(text: string) {
function tryWrapHtmlCode(text: string) { function tryWrapHtmlCode(text: string) {
// try add wrap html code (fixed: html codeblock include 2 newline) // try add wrap html code (fixed: html codeblock include 2 newline)
// ignore embed codeblock
if (text.includes("```")) {
return text;
}
return text return text
.replace( .replace(
/([`]*?)(\w*?)([\n\r]*?)(<!DOCTYPE html>)/g, /([`]*?)(\w*?)([\n\r]*?)(<!DOCTYPE html>)/g,