# madcut

> CLI tool to cut markdown file in a madly comfortable way

Latest version **3.0.1** (published 2026-01-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install madcut
pnpm add madcut
yarn add madcut
bun add madcut
```

Provides the command `madcut`.

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2026-01-26 |
| First published | 2022-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 1 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | madcut, markdown, cut, tool, commandline, command |

## Links

- npm: https://www.npmjs.com/package/madcut
- Repository: https://github.com/coderaiser/madcut
- Issues: https://github.com/coderaiser/madcut/issues
- npm.io page: https://npm.io/package/madcut

## Dependencies (1)

- [@putout/processor-markdown](https://npm.io/package/@putout/processor-markdown.md) ^13.1.1

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2026-01-26
- 3.0.0 — 2026-01-26
- 2.0.0 — 2024-01-29
- 1.4.1 — 2023-09-15
- 1.4.0 — 2023-07-09
- 1.3.0 — 2023-01-06
- 1.2.1 — 2022-10-20
- 1.2.0 — 2022-08-07
- 1.1.0 — 2022-08-07
- 1.0.0 — 2022-08-05

## README

# 🎬 MadCut [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

[NPMURL]: https://npmjs.org/package/madcut "npm"
[NPMIMGURL]: https://img.shields.io/npm/v/madcut.svg?style=flat
[BuildStatusURL]: https://github.com/coderaiser/madcut/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/coderaiser/madcut/workflows/Node%20CI/badge.svg
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[CoverageURL]: https://coveralls.io/github/coderaiser/madcut?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/madcut/badge.svg?branch=master&service=github

CLI tool to cut markdown into pieces. Based on 🐊[**Putout**](https://github.com/coderaiser/putout) code transformer.

## Install

```
npm i madcut
```

## CLI

Just run 🎬**MadCut**, it will read `README.md` and write pieces according to their headings to files.
Generally names converted to kebab form: `## Hello world` will be converted to file name `hello-world.md`.

```sh
$ madcut
```

## API

### madcut(markdown);

Infer captions to a list.

```js
import madcut from 'madcut';
import montag from 'montag';

await madcut(montag`
    # Hello
    ## World
`);

// returns
({
    index: '# Hello\n',
    world: '## World\n',
});
```

### cut(markdown)

Cut markdown file into a pieces list.

```js
import {cut} from 'madcut';
import montag from 'montag';

await cut(montag`
    # Hello
    
    ## World
    
    This is the world
`);

// returns
[
    montag`
        # Hello\n\n
    `,
    montag`
        ## World
        
        This is the world\n
    `,
];
```

### infer(markdown);

Infer captions to a list.

```js
import {infer} from 'madcut';
import montag from 'montag';

await infer(montag`
    # Hello
    ## World
`);

// returns
['World'];
```

## License

MIT

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