Skip to content

Lightweight HTML formatter that uses htmlparser2

Notifications You must be signed in to change notification settings

specious/htmlflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight and fast single-pass HTML formatter that uses htmlparser2

Description

This HTML formatter is optimized for speed and configurability. Although it may incidentally fix certain issues with malformed HTML, it is designed to work properly only with already valid markup.

Install

npm i @specious/htmlflow

Usage

const htmlflow = require('@specious/htmlflow')
const fs = require('fs')

;(async () => {
  let content = fs.readFileSync('./index.html')
  let formatted = await htmlflow(content, {
    indent: 2,
    tabs: false,
    spacesPerTab: 4,
    formatting: true,
    comments: true
  })

  console.log(formatted)
})()

About

Lightweight HTML formatter that uses htmlparser2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published