Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kjirou/embed-examples

Embed examples into README.md
https://github.com/kjirou/embed-examples

Last synced: about 1 month ago
JSON representation

Embed examples into README.md

Awesome Lists containing this project

README

        

# embed-examples

[![npm version](https://badge.fury.io/js/embed-examples.svg)](https://badge.fury.io/js/embed-examples)
[![Build Status](https://travis-ci.org/kjirou/embed-examples.svg?branch=master)](https://travis-ci.org/kjirou/embed-examples)

Embed examples into README.md

## :rocket: Installation

```bash
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

```

`my-lib/examples/foo.js`)
```
const myLib = require('my-lib');
myLib.doSomething();
```

Executing the following command ...

```bash
embed-examples -o ./README.md
```

README.md is updated as follows!

`my-lib/README.md`)
````
# my-lib

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

````

## :scroll: Usage

```bash
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