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
- Host: GitHub
- URL: https://github.com/codekirei/hanging-indent
- Owner: codekirei
- License: mit
- Created: 2015-11-02T22:26:06.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-04T00:37:40.000Z (about 7 years ago)
- Last Synced: 2025-03-08T17:01:52.493Z (8 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-nodejs-precise - hanging-indent - indent .svg?style=social&label=Star&maxAge=2592000?style=flat-square)]() | Format a string into a hanging-indented paragraph. | (Packages / Text)
README

---
[](https://travis-ci.org/codekirei/hanging-indent)
[](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)