JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7047
  • Score
    100M100P100Q126370F
  • License MIT

HTML markup formatter

Package Exports

  • html-prettify

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-prettify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

HTML Prettify

Simple lightweight HTML prettifier

Usage

const prettify = require('html-prettify');

const html = `
  <section class="wrapper">
    <ul>
      <li
        v-for="(item, i) in list"
        :key="i"
      >
        <SomeVueComponent
          size="1.5rem"
          v-html="getIcon('tickIcon').html"
        />
        <span>{{ item }}</span>
      </li>
    </ul>
    <a
      class="some-link"
      href="#"
    >Link</a>
  </section>
`;

console.log(prettify(html));
/*
OUTPUT

'<section class="wrapper">
  <ul>
    <li v-for="(item, i) in list" :key="i">
      <SomeVueComponent size="1.5rem" v-html="getIcon('tickIcon').html"/>
      <span>{{ item }}</span>
    </li>
  </ul>
  <a class="some-link" href="#">Link</a>
</section>'
*/

License

MIT License