diff --git a/kernel/api/extension.go b/kernel/api/extension.go index 48f8da5a8..f9ca9c72d 100644 --- a/kernel/api/extension.go +++ b/kernel/api/extension.go @@ -23,6 +23,7 @@ import ( "os" "path" "path/filepath" + "regexp" "strconv" "strings" @@ -177,6 +178,14 @@ func extensionCopy(c *gin.Context) { var tree *parse.Tree if "" == md { + // 通过正则将 标签中间包含的换行去掉 + regx, _ := regexp.Compile(`(?i)]*>([\s\S]*?)<\/iframe>`) + dom = regx.ReplaceAllStringFunc(dom, func(s string) string { + s = strings.ReplaceAll(s, "\n", "") + s = strings.ReplaceAll(s, "\r", "") + return s + }) + tree, withMath = model.HTML2Tree(dom, luteEngine) if nil == tree { md, withMath, _ = model.HTML2Markdown(dom, luteEngine)