MCPcopy Index your code
hub / github.com/massCodeIO/massCode / parseObsidianMarkdownFiles

Function parseObsidianMarkdownFiles

src/main/import/notes/obsidian.ts:138–214  ·  view source on GitHub ↗
(
  files: ImportFile[],
)

Source from the content-addressed store, hash-verified

136}
137
138export function parseObsidianMarkdownFiles(
139 files: ImportFile[],
140): NoteImportParseResult {
141 const notes: NoteImportCandidate[] = []
142 const warnings: NoteImportParseResult['warnings'] = []
143
144 files.forEach((file) => {
145 const filePath = getImportPath(file)
146 if (!isSupportedMarkdownFile(filePath)) {
147 if (filePath.toLowerCase().endsWith('.excalidraw.md')) {
148 warnings.push({
149 code: 'obsidian.excalidrawSkipped',
150 source: filePath,
151 })
152 }
153 return
154 }
155
156 const parsed = parseFrontmatter(file.content)
157
158 if (parsed.invalid) {
159 warnings.push({
160 code: 'obsidian.invalidFrontmatter',
161 source: filePath,
162 })
163 }
164
165 if (!parsed.content.trim()) {
166 warnings.push({
167 code: 'obsidian.emptyMarkdown',
168 source: filePath,
169 })
170 return
171 }
172
173 if (parsed.ignoredKeys.length) {
174 warnings.push({
175 code: 'obsidian.frontmatterIgnored',
176 details: {
177 fields: parsed.ignoredKeys.join(', '),
178 },
179 source: filePath,
180 })
181 }
182
183 if (hasAttachmentReferences(parsed.content)) {
184 warnings.push({
185 code: 'obsidian.attachmentsKept',
186 source: filePath,
187 })
188 }
189
190 if (hasWikiLinks(parsed.content)) {
191 warnings.push({
192 code: 'obsidian.wikiLinksKept',
193 source: filePath,
194 })
195 }

Callers 3

parsers.test.tsFile · 0.90
previewObsidianImportFunction · 0.90
applyObsidianImportFunction · 0.90

Calls 8

getImportPathFunction · 0.85
isSupportedMarkdownFileFunction · 0.85
parseFrontmatterFunction · 0.85
hasAttachmentReferencesFunction · 0.85
hasWikiLinksFunction · 0.85
getNoteNameFunction · 0.85
uniqueTagsFunction · 0.85
getFolderPathFunction · 0.70

Tested by

no test coverage detected