File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
content/zh/docs/eino/ecosystem_integration/document Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,14 @@ package main
4848
4949import (
5050 " context"
51-
51+
5252 " github.com/cloudwego/eino-ext/components/document/transformer/splitter/markdown"
5353 " github.com/cloudwego/eino/schema"
5454)
5555
5656func main () {
5757 ctx := context.Background ()
58-
58+
5959 // 初始化分割器
6060 splitter , err := markdown.NewHeaderSplitter (ctx, &markdown.HeaderConfig {
6161 Headers: map [string ]string {
@@ -68,12 +68,13 @@ func main() {
6868 if err != nil {
6969 panic (err)
7070 }
71-
71+
7272 // 准备要分割的文档
7373 docs := []*schema.Document {
7474 {
7575 ID: " doc1" ,
76- Content: ` # 文档标题
76+ Content: `
77+ # 文档标题
7778
7879这是介绍部分的内容。
7980
@@ -89,19 +90,16 @@ func main() {
8990
9091这是第二章的内容。
9192
92- \` \` \`
93- # 这是代码块中的注释,不会被识别为标题
94- \` \` \`
95- ` ,
93+ ` + " ```\n # 这是代码块中的注释,不会被识别为标题\n ```" ,
9694 },
9795 }
98-
96+
9997 // 执行分割
10098 results , err := splitter.Transform (ctx, docs)
10199 if err != nil {
102100 panic (err)
103101 }
104-
102+
105103 // 处理分割结果
106104 for i , doc := range results {
107105 println (" 片段" , i+1 , " :" , doc.Content )
@@ -113,6 +111,7 @@ func main() {
113111 }
114112 }
115113}
114+
116115```
117116
118117## ** 特性说明**
You can’t perform that action at this time.
0 commit comments