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

https://github.com/codekirei/hanging-indent

format a string into a hanging indent with Node.js
https://github.com/codekirei/hanging-indent

Last synced: 8 months ago
JSON representation

format a string into a hanging indent with Node.js

Awesome Lists containing this project

README

          

![hanging-indent](logo.png)
---
[![Build Status](https://travis-ci.org/codekirei/hanging-indent.svg?branch=master)](https://travis-ci.org/codekirei/hanging-indent)
[![Coverage Status](https://coveralls.io/repos/codekirei/hanging-indent/badge.svg?branch=master&service=github)](https://coveralls.io/github/codekirei/hanging-indent?branch=master)

[About](#about) |
[Installation](#installation) |
[API](#api) |
[License](#license)

## About

**Turn this**
```
Viral polaroid cronut etsy photo booth, tousled next level literally. Put a bird on it narwhal irony four dollar toast ugh, typewriter poutine austin VHS fashion axe. Wolf butcher humblebrag, roof party chillwave chambray actually typewriter hella messenger bag poutine green juice bitters meggings. Chicharrones irony plaid marfa hammock crucifix. Semiotics seitan fanny pack, biodiesel fingerstache humblebrag twee. Actually gastropub tousled cornhole, readymade mixtape vice yuccie skateboard williamsburg cred chillwave squid art party 90's. Occupy ramps before they sold out, ennui trust fund tacos flannel.
```

**Into this**
```
Viral polaroid cronut etsy photo booth, tousled next level literally. Put a
bird on it narwhal irony four dollar toast ugh, typewriter poutine austin
VHS fashion axe. Wolf butcher humblebrag, roof party chillwave chambray
actually typewriter hella messenger bag poutine green juice bitters
meggings. Chicharrones irony plaid marfa hammock crucifix. Semiotics seitan
fanny pack, biodiesel fingerstache humblebrag twee. Actually gastropub
tousled cornhole, readymade mixtape vice yuccie skateboard williamsburg
cred chillwave squid art party 90's. Occupy ramps before they sold out,
ennui trust fund tacos flannel.
```

Sample text courtesy [hipster ipsum](http://hipsum.co/) :neckbeard:

## Installation

**Install from terminal**

`$ npm install hanging-indent`

**Require in file**

```javascript
var hangingIndent = require('hanging-indent')
```

## API

### hangingIndent(line, indent, limit)

**Params**

* **line**: line to break into a hanging-indented paragraph
* type: string
* required: yes
* **indent**: amount of spaces to indent lines
* type: number
* required: no
* default: 4
* **limit**: max number of characters that can be in a line
* type: number
* required: no
* default: 80

**Returns**

formatted string with spaces and newlines inserted

## License

[MIT](license)