From 46a01d99b5d15120ada95754c9effbdcb576d31e Mon Sep 17 00:00:00 2001
From: ai_xiaopei <xiaopei@aisim.cn>
Date: Sun, 26 Jul 2026 08:19:23 +0800
Subject: [PATCH] Task 4: add CLI flags for with-content and with-links
---
internal/graph/builder.go | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/internal/graph/builder.go b/internal/graph/builder.go
index 9b5ca4e..428535b 100644
--- a/internal/graph/builder.go
+++ b/internal/graph/builder.go
@@ -1,6 +1,9 @@
package graph
import (
+ "path/filepath"
+ "strings"
+
"github.com/aisim/kb-cli/internal/vault"
)
@@ -92,5 +95,11 @@
}
// 匹配文件名(不含扩展名和编号前缀)
// 例如:[[充装规格配置]] 匹配 "知识/002-充装规格配置.md"
- return false // 简化版,后续可扩展
+ base := filepath.Base(node.Path)
+ base = strings.TrimSuffix(base, ".md")
+ // 去掉编号前缀(如 "002-")
+ if idx := strings.Index(base, "-"); idx >= 0 {
+ base = base[idx+1:]
+ }
+ return base == link || node.Title == link
}
--
Gitblit v1.9.1