public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/inc/lib/vendor/soundasleep/html2text/README.md
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
html2text [](https://travis-ci.org/soundasleep/html2text) [](https://packagist.org/packages/soundasleep/html2text)
2
=========
4
html2text is a very simple script that uses PHP's DOM methods to load from HTML, and then iterates over the resulting DOM to correctly output plain text. For example:
6
```html
7
<html>
8
<title>Ignored Title</title>
9
<body>
10
<h1>Hello, World!</h1>
12
<p>This is some e-mail content.
13
Even though it has whitespace and newlines, the e-mail converter
14
will handle it correctly.
16
<p>Even mismatched tags.</p>
18
<div>A div</div>
19
<div>Another div</div>
20
<div>A div<div>within a div</div></div>
22
<a href="http://foo.com">A link</a>
24
</body>
25
</html>
26
```
28
Will be converted into:
30
```text
31
Hello, World!
33
This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
35
Even mismatched tags.
36
A div
37
Another div
38
A div
39
within a div
40
[A link](http://foo.com)
41
```
43
See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/19818) or the related [StackOverflow answer](http://stackoverflow.com/a/2564472/39531).
45
## Installing
47
You can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:
49
```json
50
{
51
"require": {
52
"soundasleep/html2text": "~0.5"
53
}
54
}
55
```
57
And then use it quite simply:
59
```php
60
$text = Html2Text\Html2Text::convert($html);
61
```
63
You can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.
65
## Tests
67
Some very basic tests are provided in the `tests/` directory. Run them with `composer install --dev && vendor/bin/phpunit`.
69
## License
71
`html2text` is dual licensed under both [EPL v1.0](https://www.eclipse.org/legal/epl-v10.html) and [LGPL v3.0](http://www.gnu.org/licenses/lgpl.html), making it suitable for both Eclipse and GPL projects.
73
## Other versions
75
Also see [html2text_ruby](https://github.com/soundasleep/html2text_ruby), a Ruby implementation.