MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / resolveSourcePathFromAncestors

Function resolveSourcePathFromAncestors

src/code_embed.ts:334–346  ·  view source on GitHub ↗
(embedEl: HTMLElement, plugin: CodeSpacePlugin)

Source from the content-addressed store, hash-verified

332}
333
334function resolveSourcePathFromAncestors(embedEl: HTMLElement, plugin: CodeSpacePlugin): string {
335 for (let current: HTMLElement | null = embedEl; current; current = current.parentElement) {
336 for (const attrName of SOURCE_PATH_ATTR_CANDIDATES) {
337 const attrValue = current.getAttribute(attrName);
338 if (!attrValue) continue;
339
340 const resolvedPath = normalizeSourcePathCandidate(attrValue, plugin);
341 if (resolvedPath) return resolvedPath;
342 }
343 }
344
345 return "";
346}
347
348function disposeCodeEmbed(embedEl: HTMLElement) {
349 const ownerWindow = embedEl.ownerDocument.defaultView ?? window;

Callers 1

Calls 1

Tested by

no test coverage detected