Socket
Socket
Sign inDemoInstall

pufferfish-html

Package Overview
Dependencies
24
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pufferfish-html

An extensible html templating engine that generates static html.


Version published
Weekly downloads
2
Maintainers
1
Install size
653 kB
Created
Weekly downloads
 

Readme

Source

HTML Beautifier

A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.

What it does

  • Normalises hard tabs to spaces (or vice versa)
  • Removes trailing spaces
  • Indents after opening HTML elements
  • Outdents before closing elements
  • Collapses multiple whitespace
  • Indents after block-opening embedded Ruby (if, do etc.)
  • Outdents before closing Ruby blocks
  • Outdents elsif and then indents again
  • Indents the left-hand margin of JavaScript and CSS blocks to match the indentation level of the code

Usage

From the command line

To update files in-place:

$ htmlbeautifier file1 [file2 ...]

or to operate on standard input and output:

$ htmlbeautifier < input > output

In your code

require 'htmlbeautifier'

beautiful = HtmlBeautifier.beautify(messy)

You can also specify how to indent (the default is two spaces):

beautiful = HtmlBeautifier.beautify(messy, indent: "\t")

Installation

This is a Ruby gem. To install the command-line tool (you may need sudo):

$ gem install htmlbeautifier

To use the gem with Bundler, add to your Gemfile:

gem 'htmlbeautifier'

Contributing

  1. Follow these guidelines when writing commit messages (briefly, the first line should begin with a capital letter, use the imperative mood, be no more than 50 characters, and not end with a period).
  2. Include tests.

Keywords

FAQs

Last updated on 07 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc