GithubHelp home page GithubHelp logo

accraze / split-md Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 11.0 35 KB

:wavy_dash: Split a Markdown file into smaller files

Home Page: https://www.npmjs.com/package/split-md

License: MIT License

JavaScript 100.00%
smaller-files delimiter cli markdown markdown-parser

split-md's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.