Skip to content
Snippets Groups Projects
Commit a8a1ae32 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Rename all the markdown files

```
import fs from 'fs'
import path from 'path'

for (const file of traverse('content/articles')) {
  if (!file.endsWith('.md')) continue

  const dir = file.replace(/\.md$/, '')
  fs.mkdirSync(dir)
  fs.renameSync(file, path.join(dir, path.basename(file)))
}

function traverse(pathname) {
  const stat = fs.statSync(pathname)
  if (stat.isFile()) {
    return [pathname]
  } else if (stat.isDirectory()) {
    return fs
      .readdirSync(pathname)
      .map((v) => traverse(path.join(pathname, v)))
      .flat()
  }
  return []
}
```
parent 64202aed
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 0 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment