An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

crwlr.software logo

# 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







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).