Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mohd-akram/html-format
A Node.js library for formatting HTML strings
https://github.com/mohd-akram/html-format
html-format node nodejs npm
Last synced: 3 months ago
JSON representation
A Node.js library for formatting HTML strings
- Host: GitHub
- URL: https://github.com/mohd-akram/html-format
- Owner: mohd-akram
- License: mit
- Created: 2018-05-08T15:18:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-31T08:27:56.000Z (7 months ago)
- Last Synced: 2024-10-13T05:04:25.912Z (3 months ago)
- Topics: html-format, node, nodejs, npm
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/html-format
- Size: 95.7 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html-format
Format HTML strings by indenting, wrapping, and removing unnecessary
whitespace while preserving newlines.## Install
npm install html-format
## Usage
```javascript
import format from "html-format";const html = `\
`;
// indent = 2 spaces (default), width = 80 characters (default)
format(html) ==
`\
`;
// indent = 4 spaces, width = 80 characters (default)
format(html, " ".repeat(4)) ==
`\
`;
// indent = 4 spaces, width = 20 characters
format(html, " ".repeat(4), 20) ==
`\
`;
```