https://github.com/crwlrsoft/html-2-text
Convert HTML to formatted plain text.
https://github.com/crwlrsoft/html-2-text
Last synced: 2 months ago
JSON representation
Convert HTML to formatted plain text.
- Host: GitHub
- URL: https://github.com/crwlrsoft/html-2-text
- Owner: crwlrsoft
- License: mit
- Created: 2024-01-21T22:40:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-06T17:56:29.000Z (11 months ago)
- Last Synced: 2025-04-18T04:02:12.491Z (6 months ago)
- Language: PHP
- Size: 79.1 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# HTML to formatted Plain Text
This easy-to-use package helps you to convert HTML to formatted plain text.
## Demo
```php
use Crwlr\Html2Text\Html2Text;$html = <<
Example Website Title
console.log('test');
#app { background-color: #fff; }
Article Headline
A Subheading
Some text containing a link.
- list item
- another list item
- and one more
- second level
- third level
- second level
column 1column 2column 3
value 1value 2value 3
value 1value 2 + 3
value 1 and 2value 3
value 1value 2value 3
HTML;
$text = Html2Text::convert($html);
```
__The resulting text:__
```bash
# Article Headline
## A Subheading
Some text containing [a link](https://www.crwl.io).
* list item
* another list item
* and one more
* second level
* third level
| column 1 | column 2 | column 3 |
| -------- | -------- | -------- |
| value 1 | value 2 | value 3 |
| value 1 | value 2 + 3 |
| value 1 and 2 | value 3 |
| value 1 | value 2 | value 3 |
```
## Documentation
You can find the full documentation at [crwlr.software](https://www.crwlr.software/packages/html-2-text/getting-started).
## Contributing
If you consider contributing something to this package, read the [contribution guide (CONTRIBUTING.md)](CONTRIBUTING.md).