#!/usr/bin/env php spaces $from[] = '/\t/'; $to[] = ' '; $content = preg_replace($from, $to, $content); file_put_contents($file, trim($content) . "\n"); } function parse(string $dir): void { // Files to blacklist $blackList = []; $dirLen = strlen(dirname(__DIR__)) + 1; foreach (glob($dir . '/*') as $file) { if (is_dir($file)) { parse($file); } elseif (preg_match('/^.*\.md.?$/', $file) && !in_array(substr($file, $dirLen), $blackList, true)) { clean($file); } } } parse(__DIR__ . '/src/content/docs');