Skip to content

ivanweiler/beautify-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Beautify Html

Beautify_Html is (almost) direct PHP port of beautify-html.js, part of JS Beautifier project. It indents HTML code, making it beautiful.

Done for fun, no profit, MIT license.

Usage

$html = '<ul><li>Html</li><li>to</li><li>indent</li></ul>';
$beautify = new Beautify_Html(array(
  'indent_inner_html' => false,
  'indent_char' => " ",
  'indent_size' => 2,
  'wrap_line_length' => 32786,
  'unformatted' => ['code', 'pre'],
  'preserve_newlines' => false,
  'max_preserve_newlines' => 32786,
  'indent_scripts'	=> 'normal' // keep|separate|normal
));

echo $beautify->beautify($html);

All options are optional.

About

Html beautifier

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages