1.0.0 • Published 5 years ago

embed-examples v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

embed-examples

npm version Build Status

Embed examples into README.md

:rocket: Installation

npm install -g embed-examples

:eyes: Overview

Thie module embeds examples into README.md.

For example, put the following file ...

my-lib/README.md)

# my-lib
<!-- embed-examples: examples/foo.js -->

my-lib/examples/foo.js)

const myLib = require('my-lib');
myLib.doSomething();

Executing the following command ...

embed-examples -o ./README.md

README.md is updated as follows!

my-lib/README.md)

# my-lib
<!-- embed-examples: examples/foo.js -->
<!-- embed-example -->
```
const myLib = require('my-lib');
myLib.doSomething();
```
<!-- /embed-example -->

:scroll: Usage

embed-examples [OPTIONS] README_PATH
  • README_PATH
    • Relative path to the README.md
  • OPTIONS
    • --examples-dir $VALUE, -e
      • Base path for finding examples
      • Default: A directory path where README.md is located
    • --newline-character $VALUE, -n
      • Newline character used in markdown. However, do not change the sources of examples.
      • The value is "LF", "CR" or "CRLF"
      • Default: "LF"
    • --overwrite, -o
      • Directly rewrite README.md with path specified
      • Default: Disabled
    • --replacement $VALUE, -r
      • Keywords to replace. Represent value in the form of from,to.
      • Can specify more than one like -r keyword1,replacement1 -r keyword2,replacement2
      • Default: None