MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / buildNoteMeta

Function buildNoteMeta

apps/server/internal/vault/vault.go:1068–1087  ·  view source on GitHub ↗

--- Read / Write --- buildNoteMeta assembles NoteMeta for a note-like file. Excalidraw drawings store JSON, not Markdown, so their tags/wikilinks/excerpt are skipped — a hex color like "#1971c2" in the scene must not register as a #tag.

(relPosix, title string, folder NoteFolder, info os.FileInfo, bodyStr string)

Source from the content-addressed store, hash-verified

1066// store JSON, not Markdown, so their tags/wikilinks/excerpt are skipped — a hex
1067// color like "#1971c2" in the scene must not register as a #tag.
1068func buildNoteMeta(relPosix, title string, folder NoteFolder, info os.FileInfo, bodyStr string) NoteMeta {
1069 meta := NoteMeta{
1070 Path: relPosix,
1071 Title: title,
1072 Folder: folder,
1073 CreatedAt: info.ModTime().UnixMilli(),
1074 UpdatedAt: info.ModTime().UnixMilli(),
1075 Size: info.Size(),
1076 Tags: []string{},
1077 Wikilinks: []string{},
1078 }
1079 if isExcalidrawName(relPosix) {
1080 return meta
1081 }
1082 meta.Tags = ExtractTags(bodyStr)
1083 meta.Wikilinks = ExtractWikilinks(bodyStr)
1084 meta.HasAttachments = BodyHasLocalAsset(bodyStr)
1085 meta.Excerpt = BuildExcerpt(bodyStr)
1086 return meta
1087}
1088
1089func (v *Vault) readMeta(folder NoteFolder, abs string) (NoteMeta, error) {
1090 info, err := os.Stat(abs)

Callers 2

readMetaMethod · 0.85
ReadNoteMethod · 0.85

Calls 5

isExcalidrawNameFunction · 0.85
ExtractTagsFunction · 0.85
ExtractWikilinksFunction · 0.85
BodyHasLocalAssetFunction · 0.85
BuildExcerptFunction · 0.85

Tested by

no test coverage detected