An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Import the YAML at the beginning of the Markdown as a code block https://github.com/siyuan-note/siyuan/issues/16488
Daniel3a58d6dc6091
diff --git a/kernel/model/box.go b/kernel/model/box.goindex 0f4edfb8ba..d6ca8147ce 100644--- a/kernel/model/box.go+++ b/kernel/model/box.go@@ -650,6 +650,21 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {tree.Root.SetIALAttr("custom-"+attrK, fmt.Sprint(attrV))}++ // Import the YAML at the beginning of the Markdown as a code block https://github.com/siyuan-note/siyuan/issues/16488+ codeBlock := &ast.Node{Type: ast.NodeCodeBlock}+ openMarker := &ast.Node{Type: ast.NodeCodeBlockFenceOpenMarker, Tokens: []byte("```"), CodeBlockFenceLen: 3}+ codeBlock.AppendChild(openMarker)+ info := &ast.Node{Type: ast.NodeCodeBlockFenceInfoMarker, CodeBlockInfo: []byte("yaml")}+ codeBlock.AppendChild(info)+ content := []byte("---\n")+ content = append(content, n.Tokens...)+ content = append(content, []byte("\n---")...)+ code := &ast.Node{Type: ast.NodeCodeBlockCode, Tokens: content}+ codeBlock.AppendChild(code)+ closeMarker := &ast.Node{Type: ast.NodeCodeBlockFenceCloseMarker, Tokens: []byte("```"), CodeBlockFenceLen: 3}+ codeBlock.AppendChild(closeMarker)+ tree.Root.PrependChild(codeBlock)}if ast.NodeYamlFrontMatter == n.Type {