Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/readAllNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function readAllNotes(
withFileTypes: true
});
const notePaths = noteDirectoryEntries
.filter(entry => entry.isFile() && !entry.name.startsWith(".") && entry.name.endsWith(".md"))
.filter(entry => entry.isFile() && !entry.name.startsWith(".") && entry.name.endsWith(".md") && !entry.name.startsWith("_"))
.map(entry => path.join(noteFolderPath, entry.name));

const noteEntries = await Promise.all(
Expand Down
24 changes: 18 additions & 6 deletions lib/updateBacklinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,29 @@ export default function updateBacklinks(
entry =>
`* [[${entry.sourceTitle}]]\n${entry.context
.map(
block => `\t* ${processor.stringify(block).replace(/\n.+/, "")}\n`
block => ` * ${processor.stringify(block).replace(/\n.+/, "")}\n`
)
.join("")}`
)
.join("")}\n`;
.join("")}`.trim();
}

const newNoteContents =
noteContents.slice(0, insertionOffset) +
backlinksString +
noteContents.slice(oldEndOffset);
let newNoteContents = noteContents;

if (backlinksString) {
let end = noteContents.slice(oldEndOffset).trim();

if (end) {
end = `\n${end}\n`;
}

newNoteContents =
noteContents.slice(0, insertionOffset).trimEnd() +
"\n\n" +
backlinksString +
"\n" +
end;
}

return newNoteContents;
}