import { Plugin } from 'obsidian'; const UNSAFE_CHAR_REGEX = /[*?<>"]/g; export default class SafeFilenames extends Plugin { async onload() { this.registerEvent(this.app.vault.on('rename', (file, oldPath) => { if (UNSAFE_CHAR_REGEX.test(file.path)) { this.app.fileManager.renameFile(file, file.path.replaceAll(UNSAFE_CHAR_REGEX, '')); } })); } }