https://github.com/vikpe/php-html-heading-normalizer
PHP class for normalizing (promote/demote) HTML headings
https://github.com/vikpe/php-html-heading-normalizer
headings html php
Last synced: 9 months ago
JSON representation
PHP class for normalizing (promote/demote) HTML headings
- Host: GitHub
- URL: https://github.com/vikpe/php-html-heading-normalizer
- Owner: vikpe
- License: mit
- Created: 2016-12-22T11:41:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-31T15:17:51.000Z (over 9 years ago)
- Last Synced: 2025-01-11T02:25:25.357Z (over 1 year ago)
- Topics: headings, html, php
- Language: PHP
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP: HTML Heading Normalizer
PHP class for normalizing (promote/demote) HTML headings.
[](https://travis-ci.org/vikpe/php-html-heading-normalizer)
[](https://codeclimate.com/github/vikpe/php-html-heading-normalizer/coverage)
[](https://codeclimate.com/github/vikpe/php-html-heading-normalizer)
[](https://scrutinizer-ci.com/g/vikpe/php-html-heading-normalizer/?branch=master)
[](https://styleci.io/repos/77139895)
## Installation
```
composer require vikpe/php-html-heading-normalizer
```
## Methods
### promote(string $html, int $numberOfLevels)
Promotes all headings in `$html` by `$numberOfLevels` levels.
```php
\Vikpe\HtmlHeadingNormalizer::promote('
Foo
', 3); // 'Foo
'
```
### demote(string $html, int $numberOfLevels)
Demotes all headings in `$html` by `$numberOfLevels` levels.
```php
\Vikpe\HtmlHeadingNormalizer::demote('
Foo
', 1); // 'Foo
'
```
### min(string $html, int $minLevel)
Promotes/demotes all headings in `$html` so that the lowest heading level equals `$minLevel`.
```php
\Vikpe\HtmlHeadingNormalizer::min('
Foo
Bar
', 1); // 'Foo
Bar
'
```