This commit is contained in:
Daniel 2025-01-26 11:57:02 +08:00
parent bf78cf03b6
commit 4f3f827583
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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 {
// 通过正则将 <iframe>.*</iframe> 标签中间包含的换行去掉
regx, _ := regexp.Compile(`(?i)<iframe[^>]*>([\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)