Skip to content

Commit 15be898

Browse files
author
Ozan Tellioglu
committed
Review Corrections 2
1 parent 6f8444e commit 15be898

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/converter.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,24 @@ export const convertLinksInActiveFile = async (plugin: LinkConverterPlugin, fina
129129
// --> Command Function: Converts All Links in All Files in Vault and Save in Corresponding Files
130130
export const convertLinksInVault = async (plugin: LinkConverterPlugin, finalFormat: 'markdown' | 'wiki') => {
131131
let mdFiles: TFile[] = plugin.app.vault.getMarkdownFiles();
132-
for (let mdFile of mdFiles) {
133-
// --> Skip Excalidraw and Kanban Files
134-
if (hasFrontmatter(plugin.app, mdFile.path, 'excalidraw-plugin') || hasFrontmatter(plugin.app, mdFile.path, 'kanban-plugin')) {
135-
continue;
132+
let notice = new Notice('Starting link conversion in your vault ', 0);
133+
try {
134+
let totalCount = mdFiles.length;
135+
let counter = 0;
136+
for (let mdFile of mdFiles) {
137+
counter++;
138+
notice.setMessage(`Converting the links in your vault ${counter}/${totalCount}.`);
139+
// --> Skip Excalidraw and Kanban Files
140+
if (hasFrontmatter(plugin.app, mdFile.path, 'excalidraw-plugin') || hasFrontmatter(plugin.app, mdFile.path, 'kanban-plugin')) {
141+
continue;
142+
}
143+
await convertLinksAndSaveInSingleFile(mdFile, plugin, finalFormat);
136144
}
137-
await convertLinksAndSaveInSingleFile(mdFile, plugin, finalFormat);
145+
} catch (err) {
146+
console.log(err);
147+
} finally {
148+
notice.hide();
138149
}
139-
new Notice('Conversion for all links in your vault finished.');
140150
};
141151

142152
const hasFrontmatter = (app: App, filePath: string, keyToCheck: string) => {

0 commit comments

Comments
 (0)