Skip to content

Commit

Permalink
feat: directory whitelist for broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Sep 26, 2022
1 parent 331bacb commit 3c633a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Settings {
fileTypesToDelete: string[];
ignoreFileTypes: boolean;
ignoreDirectories: boolean;
unresolvedLinksIgnoreDirectories: boolean;
unresolvedLinksDirectoriesToIgnore: string[];
unresolvedLinksFilesToIgnore: string[];
unresolvedLinksFileTypesToIgnore: string[];
Expand All @@ -40,6 +41,7 @@ const DEFAULT_SETTINGS: Settings = {
fileTypesToDelete: [],
ignoreFileTypes: true,
ignoreDirectories: true,
unresolvedLinksIgnoreDirectories: true,
unresolvedLinksOutputFileName: "broken links output",
unresolvedLinksDirectoriesToIgnore: [],
unresolvedLinksFilesToIgnore: [],
Expand Down Expand Up @@ -270,7 +272,8 @@ export default class FindOrphanedFilesPlugin extends Plugin {
this.settings.unresolvedLinksTagsToIgnore,
this.settings.unresolvedLinksLinksToIgnore,
this.settings.unresolvedLinksDirectoriesToIgnore,
this.settings.unresolvedLinksFilesToIgnore
this.settings.unresolvedLinksFilesToIgnore,
this.settings.unresolvedLinksIgnoreDirectories,
);
if (!utils.isValid()) continue;

Expand Down
15 changes: 13 additions & 2 deletions src/settingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,18 @@ export class SettingsTab extends PluginSettingTab {
}).setValue(this.plugin.settings.unresolvedLinksOutputFileName));

new Setting(containerEl)
.setName("Exclude directories")
.setDesc("Exclude links in files in the specified directory. Add each directory path in a new line")
.setName("Exclude files in the given directories")
.setDesc("Enable to exclude files in the given directories. Disable to only include files in the given directories")
.addToggle(cb =>
cb.setValue(this.plugin.settings.unresolvedLinksIgnoreDirectories)
.onChange(value => {
this.plugin.settings.unresolvedLinksIgnoreDirectories = value;
this.plugin.saveSettings();
}));

new Setting(containerEl)
.setName("Directories")
.setDesc("Add each directory path in a new line")
.addTextArea(cb => cb
.setPlaceholder("Directory/Subdirectory")
.setValue(this.plugin.settings.unresolvedLinksDirectoriesToIgnore.join("\n"))
Expand All @@ -169,6 +179,7 @@ export class SettingsTab extends PluginSettingTab {
this.plugin.settings.unresolvedLinksDirectoriesToIgnore = paths;
this.plugin.saveSettings();
}));

new Setting(containerEl)
.setName("Exclude files")
.setDesc("Exclude links in the specified file. Add each file path in a new line (with file extension!)")
Expand Down

0 comments on commit 3c633a7

Please sign in to comment.