| 1 |
RemexHtml |
| 2 |
========= |
| 3 |
|
| 4 |
RemexHtml is a parser for HTML 5, written in PHP. |
| 5 |
|
| 6 |
RemexHtml aims to be: |
| 7 |
|
| 8 |
- Modular and flexible. |
| 9 |
- Fast, as opposed to elegant. For example, we sometimes use direct member |
| 10 |
access instead of going through accessors, and manually inline some |
| 11 |
performance-sensitive code. |
| 12 |
- Robust, aiming for O(N) worst-case performance. |
| 13 |
|
| 14 |
RemexHtml contains the following modules: |
| 15 |
|
| 16 |
- A compliant preprocessor and tokenizer. This generates a token event stream. |
| 17 |
- Compliant tree construction, including error recovery. This generates a tree |
| 18 |
mutation event stream. |
| 19 |
- A fast integrated HTML serializer, compliant with the HTML fragment |
| 20 |
serialization algorithm. |
| 21 |
- DOMDocument construction. |
| 22 |
|
| 23 |
RemexHtml presently lacks: |
| 24 |
|
| 25 |
- Encoding support. The input is expected to be valid UTF-8. |
| 26 |
- Scripting. |
| 27 |
- Precise compliance with specified parse error generation. |
| 28 |
|
| 29 |
RemexHtml aims to be compliant with W3C recommendation HTML 5.1, except for |
| 30 |
minor backported bugfixes. We chose to implement the W3C standard rather than |
| 31 |
the latest WHATWG draft because our application needs stability more than |
| 32 |
feature completeness. |
| 33 |
|
| 34 |
RemexHtml passes all [html5lib tests](https://github.com/html5lib/html5lib-tests), |
| 35 |
except for parse error counts and tests which reference a future version of the |
| 36 |
standard. |
| 37 |
|
| 38 |
**WARNING** This is a new project, we are still developing use cases. So the API |
| 39 |
is subject to change. |
| 40 |
|
| 41 |
For example code, see `bin/test.php`. |