Skip to content

Commit 611a464

Browse files
kylehowellsclaude
andcommitted
Move Spec Compliance section and improve formatting
- Move section after Usage, before Performance - Add reference to justhtml having the same compliance - Convert test results to table format - Total: 8,953 tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 72c2c15 commit 611a464

File tree

1 file changed

+25
-42
lines changed

1 file changed

+25
-42
lines changed

README.md

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,6 @@ Swift port of [justhtml](https://github.com/EmilStenstrom/justhtml) (Python) and
1414
- **Streaming API** - Memory-efficient event-based parsing
1515
- **Fragment Parsing** - Parse HTML fragments in specific contexts
1616

17-
## Spec Compliance
18-
19-
swift-justhtml implements the [WHATWG HTML parsing specification](https://html.spec.whatwg.org/multipage/parsing.html) exactly and passes all tests from the official [html5lib-tests](https://github.com/html5lib/html5lib-tests) suite used by browser vendors.
20-
21-
### Test Results
22-
23-
```
24-
Tree Construction Tests
25-
ALL TESTS: 1831/1831 passed, 0 failed
26-
27-
Includes: adoption, blocks, comments, doctype, entities,
28-
foreign-fragment, math, svg, tables, template, webkit, and more
29-
30-
Tokenizer Tests
31-
TOKENIZER TESTS: 6810/6810 passed, 0 failed
32-
33-
Includes: entities, numeric entities, escape flags,
34-
content model flags, unicode chars, and more
35-
36-
Serializer Tests
37-
SERIALIZER TESTS: 230/230 passed, 0 failed
38-
39-
Includes: optional tags, whitespace, injection tests
40-
41-
Encoding Tests
42-
ENCODING TESTS: 82/82 passed, 0 failed
43-
```
44-
45-
### Fuzz Testing
46-
47-
The parser has been fuzz tested with millions of randomized and malformed HTML documents to ensure it never crashes or hangs on any input:
48-
49-
- Random data fuzzing with varying document sizes
50-
- Fragment context fuzzing
51-
- Deep nesting stress tests
52-
- Malformed tag and entity sequences
53-
54-
Run the fuzzer yourself:
55-
```bash
56-
swift test --filter fuzzTest
57-
```
58-
5917
## Installation
6018

6119
### Swift Package Manager
@@ -171,6 +129,31 @@ for error in doc.errors {
171129
}
172130
```
173131

132+
## Spec Compliance
133+
134+
swift-justhtml implements the [WHATWG HTML parsing specification](https://html.spec.whatwg.org/multipage/parsing.html) exactly and passes all tests from the official [html5lib-tests](https://github.com/html5lib/html5lib-tests) suite (used by browser vendors), the same as [justhtml](https://github.com/EmilStenstrom/justhtml).
135+
136+
### Test Results
137+
138+
| Test Suite | Passed | Failed |
139+
|------------|--------|--------|
140+
| Tree Construction | 1,831 | 0 |
141+
| Tokenizer | 6,810 | 0 |
142+
| Serializer | 230 | 0 |
143+
| Encoding | 82 | 0 |
144+
| **Total** | **8,953** | **0** |
145+
146+
### Fuzz Testing
147+
148+
The parser has been fuzz tested with millions of randomized and malformed HTML documents to ensure it never crashes or hangs on any input:
149+
150+
- Random data fuzzing with varying document sizes
151+
- Fragment context fuzzing
152+
- Deep nesting stress tests
153+
- Malformed tag and entity sequences
154+
155+
Run the fuzzer: `swift test --filter fuzzTest`
156+
174157
## Performance
175158

176159
swift-justhtml is optimized for performance, matching or exceeding JavaScript implementations:

0 commit comments

Comments
 (0)