Enhance chain inspection functionality with editor content support
- Updated `inspectChains` to accept optional `editorContent`, allowing for real-time inspection without relying on potentially stale vault data. - Introduced `buildNoteIndexFromContent` to facilitate graph indexing directly from provided content. - Improved handling of template matching profiles in `ChainWorkbenchModal`, ensuring accurate context during chain inspections. - Added debug logging for better traceability of the chain inspection process.
This commit is contained in:
1 parent
dbd76b764d
commit
99c77ef616
5 files changed
+200
-20
No files matched your search
@@ -83,13 +83,27 @@ function parseTarget(linkText: string, currentFilePath: string, sections: NoteSe
|
||||
}
|
||||
|
||||
/**
|
||||
* Build graph index for a single note.
|
||||
* Build graph index for a single note from file content.
|
||||
* Use buildNoteIndexFromContent if you have the content already (e.g., from editor).
|
||||
*/
|
||||
export async function buildNoteIndex(
|
||||
app: App,
|
||||
file: TFile
|
||||
): Promise<{ edges: IndexedEdge[]; sections: SectionNode[] }> {
|
||||
const content = await app.vault.read(file);
|
||||
return buildNoteIndexFromContent(app, file, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build graph index for a single note from provided content.
|
||||
* This is useful when you have the content from an editor and want to avoid
|
||||
* reading stale data from the vault cache.
|
||||
*/
|
||||
export async function buildNoteIndexFromContent(
|
||||
app: App,
|
||||
file: TFile,
|
||||
content: string
|
||||
): Promise<{ edges: IndexedEdge[]; sections: SectionNode[] }> {
|
||||
const sections = splitIntoSections(content);
|
||||
const edges: IndexedEdge[] = [];
|
||||
const sectionNodes: SectionNode[] = [];
|
||||
|
||||
Reference in new issue
Block a user