Write stable block-id links and always start the interview wizard.
New notes and workbench edges now emit [[Note#Heading ^block]] or [[#^id]] so vaults stay ingestible without mass relinks. Create-from-profile always opens the wizard; a command can restart it on the current note. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c40a89096f
commit
56ae6a2407
29 files changed
+1448
-274
No files matched your search
@@ -102,6 +102,8 @@ export interface HeadingWithType {
|
||||
heading: string;
|
||||
sectionType: string | null;
|
||||
level: number;
|
||||
/** Block-ID from `## Title ^id`; null if the heading has none. */
|
||||
blockId: string | null;
|
||||
}
|
||||
|
||||
export async function getHeadingsWithSectionTypes(
|
||||
@@ -115,10 +117,11 @@ export async function getHeadingsWithSectionTypes(
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
if (line === undefined) continue;
|
||||
const match = line.match(/^(#{1,6})\s+(.+?)(?:\s*\^[\w-]+)?\s*$/);
|
||||
const match = line.match(/^(#{1,6})\s+(.+?)(?:\s*\^([a-zA-Z0-9_-]+))?\s*$/);
|
||||
if (match && match[1] && match[2]) {
|
||||
const level = match[1].length;
|
||||
const heading = match[2].trim();
|
||||
const blockId = match[3] ?? null;
|
||||
let sectionType: string | null = null;
|
||||
for (let j = i + 1; j < Math.min(i + 5, lines.length); j++) {
|
||||
const nextLine = lines[j];
|
||||
@@ -129,7 +132,7 @@ export async function getHeadingsWithSectionTypes(
|
||||
break;
|
||||
}
|
||||
}
|
||||
result.push({ heading, sectionType, level });
|
||||
result.push({ heading, sectionType, level, blockId });
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user