Package Exports
- html-format
- html-format/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-format) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
html-format
Format HTML strings by indenting, wrapping, and removing unnecessary whitespace while preserving newlines.
Install
npm install html-formatUsage
import format from "html-format";
const html = `\
<body>
<main class="grid"> </main>
</body>
`;
// indent = 2 spaces (default), width = 80 characters (default)
format(html) ==
`\
<body>
<main class="grid"> </main>
</body>
`;
// indent = 4 spaces, width = 80 characters (default)
format(html, " ".repeat(4)) ==
`\
<body>
<main class="grid"> </main>
</body>
`;
// indent = 4 spaces, width = 20 characters
format(html, " ".repeat(4), 20) ==
`\
<body>
<main
class="grid">
</main>
</body>
`;