sm
split-md
npm i split-md
sm

split-md

〰️ Split a Markdown file into smaller files

by A. Craze

0.3.0 (see all)License:MITTypeScript:Not Found
npm i split-md
Readme

travis build version license semantic-release Commitizen friendly

split-md

NodeJS CLI that splits a Markdown file into smaller files based on a given delimiter. It's basically str.split(pattern) for .md files.

Install

$ npm install split-md

Useage

To use the CLI, type split-md followed by it's args:

  • readPath (path to larger .md file)
  • pattern (string)
  • cleanName (string): do you want to remove anything from the pattern?
  • writePath (path to where smaller files should be created)
  • limit (optionally limit the number of files created)
  • hasCounter (optionally have the outputted files names be numbered)

Example

$ split-md 'tests/testdata.md' '### v' '###' '' 10 true

In the above example we are reading in tests/testdata.md. Our delimiter is whenever we see a line start with the pattern ### v. We want to use this line for our new markdown file's name, however we want to remove the ### by setting it as the cleanName variable. Next, we are setting the writePath to our current working directory by giving an empty string as this variable. Also note that we are setting our limit to only create 10 files before exiting. Lastly, we have true to show that we want the file names to be ordered.

License:

MIT License 2016-2018 © Andy Craze & contributors

Downloads/wk

4

GitHub Stars

17

LAST COMMIT

3yrs ago

MAINTAINERS

2

CONTRIBUTORS

2

OPEN ISSUES

1

OPEN PRs

1
VersionTagPublished
0.3.0
latest
3yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate