(markdown: string, resolve: ExpandEmbedsCtx['resolve'], fromPath: string)
| 120 | /** Returns true when a note's markdown contains at least one note-embed. Cheap |
| 121 | * pre-check so callers can skip the async work entirely for the common case. */ |
| 122 | export function hasNoteEmbeds(markdown: string, resolve: ExpandEmbedsCtx['resolve'], fromPath: string): boolean { |
| 123 | if (!markdown.includes('![[')) return false |
| 124 | const ranges = codeRanges(markdown) |
| 125 | return [...markdown.matchAll(EMBED_RE)].some((m) => { |
| 126 | if (inCode(m.index!, ranges)) return false |
| 127 | const target = (m[1].split('|', 1)[0] ?? '').trim() |
| 128 | return !!target && !!resolve(target, fromPath) |
| 129 | }) |
| 130 | } |
| 131 | |
| 132 | /** Expand every `![[Note]]` note-embed in `markdown` into inline content, |
| 133 | * recursively, with cycle + depth guards. Non-note targets are left untouched. */ |
no test coverage detected