kevintweber / groundskeeper
Groundskeeper will clean your weedy HTML.
Installs: 111
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/kevintweber/groundskeeper
Requires
- php: ^5.5.9|^7.0
- kevintweber/html-tokenizer: ^0.3
- psr/log: ^1.0
- symfony/options-resolver: ^2.8|^3.0
This package is not auto-updated.
Last update: 2020-01-25 01:08:59 UTC
README
Groundskeeper will clean your weedy HTML.
Install
Via Composer
$ composer require kevintweber/groundskeeper
Usage
Here is a simple example:
use Groundskeeper\Groundskeeper; $groundskeeper = new Groundskeeper(array( 'output' => 'pretty' )); $groundskeeper->setLogger($myLogger); // Optional: will log changes to your HTML. $cleanHtml = $groundskeeper->clean($dirtyHtml);
Options
clean-strategy: Describes how the HTML document will be cleaned.- Options:
none,lenient,standard,aggressive; Default:standardnone- No cleaning will be done.lenient- Likestandardexcept no markup will be removed.standard- Standard compliant HTML will be output. Unfixable malformed HTML will be removed.aggressive- Like "standard" plus non-standard elements will be removed. (TODO)
- Options:
element-blacklist: Describes which elements will be removed from the output.- Options: Comma seperated list of elements; Default: `` (empty list)
indent-spaces: The number of spaces for indentation when using pretty output.- Options: integer greater than or equal to 0; Default: 4
output: Describes how the HTML will be output.- Options:
compact,pretty; Default:compactcompact- Will remove all whitespace between elements, and will setindent-spacesto 0.pretty- One element per line with indentation. Handy for debugging.
- Options:
type-blacklist: Describes which token types will be removed from the output.- Options: Comma seperated list of any of the following:
cdata,comment,doctype,element,php,text; Default:cdata,comment
- Options: Comma seperated list of any of the following:
Todo
- Implement
aggressivecleaning strategy. prettyoutput should inline certain elements.- Add option to remove / sanitize all JS attributes.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.