0.3.2 • Published 2 years ago

organize-md v0.3.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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
touch config.js
{
  "contentDir": "content/",
  "mdOutDir": "public/guides/",
  "imgOutDir": "public/images/guides/",
  "imgURLPrefix": "/images/guides/"
}
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:

;[
  {
    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.

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.

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago