mirror of
https://github.com/kdnk/obsidian-automatic-linker.git
synced 2026-07-22 05:37:46 +00:00
chore: run Obsidian Linter after automatic linker formatting
This commit is contained in:
parent
54a457b3d1
commit
d3a02df3c1
3 changed files with 8 additions and 7 deletions
|
|
@ -378,14 +378,15 @@ export default class AutomaticLinkerPlugin extends Plugin {
|
|||
if (checking) {
|
||||
return saveCallback?.(checking);
|
||||
} else {
|
||||
// Run Obsidian Linter before formatting if enabled
|
||||
if (this.settings.runLinterBeforeFormatting) {
|
||||
await this.formatOnSave();
|
||||
|
||||
// Run Obsidian Linter after formatting if enabled
|
||||
if (this.settings.runLinterAfterFormatting) {
|
||||
//@ts-expect-error
|
||||
await this.app?.commands?.executeCommandById(
|
||||
"obsidian-linter:lint-file",
|
||||
);
|
||||
}
|
||||
await this.formatOnSave();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export type AutomaticLinkerSettings = {
|
|||
excludeDirsFromAutoLinking: string[]; // Optional: List of directories to exclude from auto-linking
|
||||
preventSelfLinking: boolean; // Prevent linking text to its own file
|
||||
removeAliasInDirs: string[]; // Remove aliases for links in specified directories
|
||||
runLinterBeforeFormatting: boolean; // Run Obsidian Linter before automatic linker formatting
|
||||
runLinterAfterFormatting: boolean; // Run Obsidian Linter after automatic linker formatting
|
||||
};
|
||||
|
||||
export const DEFAULT_SETTINGS: AutomaticLinkerSettings = {
|
||||
|
|
@ -41,5 +41,5 @@ export const DEFAULT_SETTINGS: AutomaticLinkerSettings = {
|
|||
excludeDirsFromAutoLinking: [], // Default: no excluded directories
|
||||
preventSelfLinking: false, // Default: allow self-linking (backward compatibility)
|
||||
removeAliasInDirs: [], // Default: no directories for alias removal
|
||||
runLinterBeforeFormatting: false, // Default: do not run linter before formatting
|
||||
runLinterAfterFormatting: false, // Default: do not run linter after formatting
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ export class AutomaticLinkerPluginSettingsTab extends PluginSettingTab {
|
|||
)
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
.setValue(this.plugin.settings.runLinterBeforeFormatting)
|
||||
.setValue(this.plugin.settings.runLinterAfterFormatting)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.runLinterBeforeFormatting = value;
|
||||
this.plugin.settings.runLinterAfterFormatting = value;
|
||||
await this.plugin.saveData(this.plugin.settings);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue