Closed tofu-connected closed 1 year ago
So there's something that can help you there, there's already a "whitelist extension" in settings:
Even if the files that you want to keep history for have the same extension as the ones you don't, you can still use the whitelist: the trick is that the whitelist not only works for extensions but for any substring the file ends with (suffix): the code will keep the history file if the filename ends with any of those words and there's no reason why you cannot put a whole filename there:
// Keep an edit history file for all files if there are no extensions,
// otherwise just for the extensions that match
if (this.extensionWhitelist.length == 0) {
return true;
} else {
const filename = file.name.toLowerCase();
for (let ext of this.extensionWhitelist) {
if (filename.endsWith(ext)) {
return true;
}
}
}
return false;
Eg if you have "badfile.md" and "goodfile.md" and you want to keep the history for "goodfile.md", just remove ".md" from the whitelist and put "goodfile.md" instead (or even "odfile.md"). This will even work if the filename you want to put in the whitelist has a space in the middle since the list separator is the comma (but obviously won't if you want to put a filename with a comma in it).
Closing, since this seems to solve your issue.
If there are a a lot of different kinds of files in the project, one might want to keep history only for some files and don't clutter the the vault with unnecessary history files.