markmv - v1.41.7
    Preparing search index...

    Function validateOperation

    • Convenience function that re-parses the files an operation modified or created (those that still exist on disk) and checks that every link in them resolves. A validation failure is reported in the result rather than thrown.

      Parameters

      Returns Promise<{ brokenLinks: number; errors: string[]; valid: boolean }>

      Promise resolving to the validity flag, the number of broken links and a message for each

      import { moveFile, validateOperation } from 'markmv';

      const result = await moveFile('old.md', 'new.md');
      const validation = await validateOperation(result);

      if (!validation.valid) {
      console.error(`Found ${validation.brokenLinks} broken links`);
      }