https://github.com/coderaiser/madcut
CLI tool to cut markdown file in a madly comfortable way
https://github.com/coderaiser/madcut
Last synced: 2 months ago
JSON representation
CLI tool to cut markdown file in a madly comfortable way
- Host: GitHub
- URL: https://github.com/coderaiser/madcut
- Owner: coderaiser
- License: mit
- Created: 2022-08-04T20:03:56.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-01-29T08:45:48.000Z (about 2 years ago)
- Last Synced: 2025-10-05T14:39:56.614Z (6 months ago)
- Language: JavaScript
- Size: 41 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
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