From 596bd6445deb21480de7a6347ba203796f00aeb4 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Fri, 20 Aug 2021 21:40:02 +0200 Subject: [PATCH] fix(Hierarchy Note): :bug: Blanks line allowed --- src/main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index d2a2d792..fe1d9371 100644 --- a/src/main.ts +++ b/src/main.ts @@ -311,7 +311,8 @@ export default class BreadcrumbsPlugin extends Plugin { } hierarchyNoteAdjList = (str: string) => { - const layers = str.split("\n"); + const layers = str.split("\n").filter((line) => line); + console.log({ layers }); const depth = (line: string) => line.split("-")[0].length; @@ -319,10 +320,11 @@ export default class BreadcrumbsPlugin extends Plugin { const lineRegex = new RegExp(/\s*- \[\[(.*)\]\]/); + console.log({ str }); let lineNo = 0; while (lineNo < layers.length) { const currLine = layers[lineNo]; - if (currLine === "") continue; + const currNote = currLine.match(lineRegex)[1]; const currDepth = depth(currLine); @@ -330,6 +332,7 @@ export default class BreadcrumbsPlugin extends Plugin { if (lineNo !== layers.length - 1) { const nextLine = layers[lineNo + 1]; + console.log({ nextLine }); const nextNote = nextLine.match(lineRegex)[1]; const nextDepth = depth(nextLine);