mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 18:10:12 +01:00
🎨 Improve HTML clipping https://github.com/siyuan-note/siyuan/issues/13885
This commit is contained in:
parent
bf78cf03b6
commit
4f3f827583
1 changed files with 9 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue