Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-06-23 11:22:48 +08:00
commit 35cf6d1b49
4 changed files with 32 additions and 2 deletions

View file

@ -26,6 +26,7 @@ type FileTree struct {
RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储文件夹路径
CreateDocNameTemplate string `json:"createDocNameTemplate"` // 新建文档名模板
MaxListCount int `json:"maxListCount"` // 最大列出数量
MaxOpenTabCount int `json:"maxOpenTabCount"` // 最大打开页签数量
AllowCreateDeeper bool `json:"allowCreateDeeper"` // 允许创建超过 7 层深度的子文档
RemoveDocWithoutConfirm bool `json:"removeDocWithoutConfirm"` // 删除文档时是否不需要确认
@ -39,6 +40,7 @@ func NewFileTree() *FileTree {
Sort: util.SortModeCustom,
CreateDocNameTemplate: "",
MaxListCount: 512,
MaxOpenTabCount: 12,
AllowCreateDeeper: false,
}
}

View file

@ -130,6 +130,9 @@ func InitConf() {
if 1 > Conf.FileTree.MaxListCount {
Conf.FileTree.MaxListCount = 512
}
if 1 > Conf.FileTree.MaxOpenTabCount {
Conf.FileTree.MaxOpenTabCount = 12
}
if nil == Conf.Tag {
Conf.Tag = conf.NewTag()
}

View file

@ -506,6 +506,22 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
walkStatus = ast.WalkSkipChildren
return
case ast.NodeLinkDest:
text := n.TokensStr()
markdown := treenode.FormatNode(n.Parent, luteEngine)
parentBlock := treenode.ParentBlock(n)
span := &Span{
ID: ast.NewNodeID(),
BlockID: parentBlock.ID,
RootID: rootID,
Box: boxID,
Path: p,
Content: text,
Markdown: markdown,
Type: treenode.TypeAbbr(n.Type.String()),
IAL: treenode.IALStr(n),
}
spans = append(spans, span)
// assetsLinkDestsInTree
if !IsAssetLinkDest(n.Tokens) {
@ -514,7 +530,7 @@ func buildSpanFromNode(n *ast.Node, tree *parse.Tree, rootID, boxID, p string) (
}
dest := gulu.Str.FromBytes(n.Tokens)
parentBlock := treenode.ParentBlock(n)
parentBlock = treenode.ParentBlock(n)
var title string
if titleNode := n.Parent.ChildByType(ast.NodeLinkTitle); nil != titleNode {
title = gulu.Str.FromBytes(titleNode.Tokens)

View file

@ -75,7 +75,15 @@ func NodeStaticContent(node *ast.Node) string {
buf.WriteString(GetDynamicBlockRefText(n))
lastSpace = false
return ast.WalkSkipChildren
case ast.NodeText, ast.NodeLinkText, ast.NodeLinkTitle, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
case ast.NodeLinkText:
buf.Write(n.Tokens)
buf.WriteByte(' ')
case ast.NodeLinkDest:
buf.Write(n.Tokens)
buf.WriteByte(' ')
case ast.NodeLinkTitle:
buf.Write(n.Tokens)
case ast.NodeText, ast.NodeFileAnnotationRefText, ast.NodeFootnotesRef,
ast.NodeCodeSpanContent, ast.NodeInlineMathContent, ast.NodeCodeBlockCode, ast.NodeMathBlockContent, ast.NodeHTMLBlock:
buf.Write(n.Tokens)
case ast.NodeBackslash:
@ -204,6 +212,7 @@ var typeAbbrMap = map[string]string{
// 行级元素
"NodeText": "text",
"NodeLinkText": "link_text",
"NodeLinkDest": "link_dest",
"NodeTag": "tag",
"NodeCodeSpan": "code_span",
"NodeInlineMath": "inline_math",