beautify-html

1.0.3Β β€’Β PublicΒ β€’Β Published

beautify-html 🎨

A simple customisable NPM package πŸ“¦ to instantly beautify boring HTML documents 🎨

Install

Using npm:

npm i beautify-html

Setting up

Import the package with ES6 modules:

import beautify from "beautify-html";

Include the js file in the HTML document:

<script type="module" src="yourfile.js"></script>

Apply the styling

To apply the styling, call the beautify function with the type of theme you want and primary color.

Syntax

beautify(theme, color, [, optIn?: boolean])

Examples

import beautify from "beautify-html";

// light theme with blue primary color
beautify("light", "blue");

// dark theme with purple primary color
beautify("dark", "purple");

Before

Screen Shot 2021-03-25 at 17 10 45

After

Screen Shot 2021-03-25 at 15 59 09 Screen Shot 2021-03-25 at 15 58 58

List of themes and colors

Themes:

  1. light
  2. dark

Colors:

  1. blue
  2. red
  3. purple
  4. green
  5. orange

Using classes

You can opt in into styling the document per element, similary of how you would use bootstrap for example.

Attributes included are:

  • .beautify-text
  • .beautify-title
  • .beautify-input
  • .beautify-button
  • .beautify-link
  • .beautify-hr
  • .beautify-table
  • .beautify-ul

Examples

import beautify from "beautify-html";

// setting the opt in parameter to true will enable
// stying only to selected elements
beautify("light", "blue", true);
<body>
  <h1 class="beautify-title">Lorem Ipsum</h1>
  ...
  <form method="get">
    ...
    <input class="beautify-input" type="text" />
    ...
    <input class="beautify-button" type="submit" />
    ...
  </form>
  ...
</body>

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i beautify-html

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

6.91 kB

Total Files

4

Last publish

Collaborators

  • guyariely