Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/machy8/xhtml-formatter
⚒ Simple, lightweight, customizable (X)HTML and XML formatter / beautifier
https://github.com/machy8/xhtml-formatter
beautifier formatter html xhtml xml
Last synced: about 2 months ago
JSON representation
⚒ Simple, lightweight, customizable (X)HTML and XML formatter / beautifier
- Host: GitHub
- URL: https://github.com/machy8/xhtml-formatter
- Owner: Machy8
- License: bsd-3-clause
- Created: 2017-05-30T17:01:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-01T20:21:48.000Z (almost 7 years ago)
- Last Synced: 2024-11-07T08:50:58.362Z (about 2 months ago)
- Topics: beautifier, formatter, html, xhtml, xml
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 10
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
README
# XML + (X)HTML formatter / beautifier
[![Build Status](https://travis-ci.org/Machy8/xhtml-formatter.svg?branch=0.1)](https://travis-ci.org/Machy8/xhtml-formatter)
## Installation
````
composer require machy8/xhtml-formatter
````## Usage
Compiles this 💩
````HTMLtitle
````
into this 😱😭
````HTML
title
````
and all you need is
````PHP
use XhtmlFormatter\Formatter;$formatter = new Formatter();
$output = $formatter->format($string);
````and if you want to disable formatting
````HTML
Unformatted code goes here!
````
## Setup
````PHP
$formatter// Change the content type from CONTENT_HTML (default) to CONTENT_XML or CONTENT_XHTML
->setContentType(Formatter::CONTENT_XML)// Add new unpaired element
->addUnpairedElement('element', Formatter::CONTENT_XML)// Add skipped elements
->addSkippedElement('elementA elementB')// Indent file by 4 spaces instead of tabs
->setSpacesIndentationMethod(4);````