@@ -36,10 +36,10 @@ func init() {
36
36
mdStructuredLuteEngine .SetKramdownIAL (true )
37
37
mdStructuredLuteEngine .SetKramdownIALIDRenderName ("data-block-id" )
38
38
// 嵌入块的 id
39
- var id string
39
+ var refID string
40
40
/** 获取块的id */
41
41
var getBlockID = func (n * ast.Node , _ bool ) (string , ast.WalkStatus ) {
42
- id = n .TokensStr ()
42
+ refID = n .TokensStr ()
43
43
return "" , ast .WalkContinue
44
44
}
45
45
@@ -66,13 +66,13 @@ func init() {
66
66
LuteEngine .Md2HTMLRendererFuncs [ast .NodeBlockRefText ] = func (n * ast.Node , entering bool ) (string , ast.WalkStatus ) {
67
67
var html string
68
68
if entering {
69
- fileEntity , mdInfo , err := FindFileEntityFromID (id )
69
+ fileEntity , mdInfo , err := FindFileEntityFromID (refID )
70
70
if err != nil {
71
71
return "" , ast .WalkContinue
72
72
}
73
73
var src string
74
74
if fileEntity .path != "" {
75
- src = FileEntityRelativePath (baseEntity , fileEntity , id )
75
+ src = FileEntityRelativePath (baseEntity , fileEntity , refID )
76
76
}
77
77
var title = n .Text ()
78
78
@@ -96,7 +96,7 @@ func init() {
96
96
97
97
var html string
98
98
if entering {
99
- fileEntity , mdInfo , err := FindFileEntityFromID (id )
99
+ fileEntity , mdInfo , err := FindFileEntityFromID (refID )
100
100
if err != nil {
101
101
return "" , ast .WalkContinue
102
102
}
@@ -108,7 +108,7 @@ func init() {
108
108
} else {
109
109
var src string
110
110
if fileEntity .path != "" {
111
- src = FileEntityRelativePath (baseEntity , fileEntity , id )
111
+ src = FileEntityRelativePath (baseEntity , fileEntity , refID )
112
112
}
113
113
// 修改 base 路径以使用 ../ 这样的形式指向根目录再深入到待解析的md文档所在的路径 ,就在下面一点点会再重置回去
114
114
LuteEngine .RenderOptions .LinkBase = strings .Repeat ("../" , strings .Count (baseEntity .relativePath , "/" )- 1 ) + "." + path .Dir (fileEntity .relativePath )
@@ -136,6 +136,9 @@ func init() {
136
136
ids := db .SQLToID (sql )
137
137
138
138
for _ , id := range ids {
139
+ // if id == baseEntity. {
140
+ // continue
141
+ // }
139
142
140
143
fileEntity , mdInfo , err := FindFileEntityFromID (id )
141
144
if err != nil {
0 commit comments