# organize-md

> Builds your markdown folder structure to be ready for static deployment.

Latest version **0.3.2** (published 2023-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install organize-md
pnpm add organize-md
yarn add organize-md
bun add organize-md
```

Provides the command `organize-md`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2023-06-21 |
| First published | 2023-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | meoyawn |

## Links

- npm: https://www.npmjs.com/package/organize-md
- npm.io page: https://npm.io/package/organize-md

## Dependencies (9)

- [arg](https://npm.io/package/arg.md) ^5.0.2
- [zod](https://npm.io/package/zod.md) ^3.21.4
- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [unist-util-map](https://npm.io/package/unist-util-map.md) ^3.1.3
- [mdast-util-frontmatter](https://npm.io/package/mdast-util-frontmatter.md) ^1.0.1
- [mdast-util-to-markdown](https://npm.io/package/mdast-util-to-markdown.md) ^1.5.0
- [mdast-util-from-markdown](https://npm.io/package/mdast-util-from-markdown.md) ^1.3.0
- [micromark-extension-frontmatter](https://npm.io/package/micromark-extension-frontmatter.md) ^1.1.0

## Recent versions

- 0.3.2 (latest) — 2023-06-21
- 0.3.1 — 2023-05-22
- 0.3.0 — 2023-05-15
- 0.2.11 — 2023-05-11
- 0.2.10 — 2023-05-11
- 0.2.9 — 2023-05-11
- 0.2.8 — 2023-05-11
- 0.2.7 — 2023-05-11
- 0.2.6 — 2023-05-11
- 0.2.5 — 2023-05-11
- 0.2.4 — 2023-05-11
- 0.2.3 — 2023-05-11
- 0.2.2 — 2023-05-11
- 0.2.1 — 2023-05-11
- 0.2.0 — 2023-05-11
- … 9 more at https://npm.io/package/organize-md/versions

## README

# organize-md

Builds your markdown folder structure to be ready for static deployment.

It takes a JSON configuration file as an argument. Reads the contents of a specified directory, processes
markdown files and images, and outputs the modified markdown files and images to specified output directories. The
script also generates a `meta.json` file containing metadata about the processed markdown files.

### Input structure:

```
content
├── android
│   ├── googleplay.svg
│   ├── index.md
│   └── share.jpg
├── ios
│   ├── appstore.svg
│   ├── gallery.jpeg
│   ├── index.md
│   ├── settings.jpeg
│   └── share.jpg
├── publishing
│   ├── index.md
│   ├── itunes.png
│   ├── rsscopy.png
│   └── spotify.png
└── tutorial
    └── index.md
```

```sh
touch config.js
```

```json
{
  "contentDir": "content/",
  "mdOutDir": "public/guides/",
  "imgOutDir": "public/images/guides/",
  "imgURLPrefix": "/images/guides/"
}
```

```sh
yarn add organize-md

yarn organize-md config.json
```

### Output structure:

```
public/guides
├── android.md
├── ios.md
├── meta.json
├── publishing.md
└── tutorial.md

public/images/guides
├── android
│   ├── googleplay-b761f3.svg
│   └── share-58f774.jpg
├── ios
│   ├── appstore-b60244.svg
│   ├── gallery-aca28c.jpeg
│   ├── settings-f10556.jpeg
│   └── share-60e923.jpg
└── publishing
    ├── itunes-f1bf0c.png
    ├── rsscopy-0f6e3f.png
    └── spotify-ba1398.png
```

## Framework configuration for optimized image loading

### Next.js

In `next.config.js` `headers()` array add this:

```js
;[
  {
    source: "/images/*",
    headers: [
      {
        key: "Cache-Control",
        value: "public, max-age=31536000, immutable",
      },
    ],
  },
]
```

Where `/images/*` matches the `imgURLPrefix` value from the config file.

[Next.js headers doc.](https://nextjs.org/docs/pages/api-reference/next-config-js/headers)

### Remix deployed to Cloudflare Pages

In `public/_headers` file add this:

```
/images/*
  Cache-Control: public, max-age=31536000, immutable
```

Where `/images/*` matches the `imgURLPrefix` value from the config file.

[Cloudflare Pages headers doc.](https://developers.cloudflare.com/pages/platform/headers/)

---
_Source: https://npm.io/package/organize-md · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
