Skip to content

Commit

Permalink
fix(Hierarchy Note): 🐛 Any indentation allowed. For real this time
Browse files Browse the repository at this point in the history
Use lowest common multiple instead (I'm kinda cheating to get the lcm, but taking advantage of the step-by-step indentation to make the shortcut)
  • Loading branch information
SkepticMystic committed Aug 21, 2021
1 parent cada5c3 commit 7d5c596
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,21 @@ export default class BreadcrumbsPlugin extends Plugin {
}
});

console.log({ differences });

const posFilteredDifferences = differences
.filter((diff) => diff !== 0)
.map(Math.abs);

const noDup = removeDuplicates(posFilteredDifferences);
if (noDup.length > 1) {
const lcm = Math.min(...posFilteredDifferences);

if (!posFilteredDifferences.every((diff) => diff % lcm === 0)) {
new Notice(
"Please make sure the indentation is consistent in your hierarchy note."
);
return [];
}
const difference = noDup[0];
const difference = lcm;

const hier: { note: string; depth: number; children: string[] }[] = [];

Expand Down

0 comments on commit 7d5c596

Please sign in to comment.