aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-09-03 23:02:01 +0200
committerMartin Fischer <martin@push-f.com>2023-09-03 23:02:01 +0200
commit0c590e90564870fa8600460c866c7395b7d865cd (patch)
treed702e200ed5b815a32b6bbd3cf7c6e8c5c370c9c /README.md
parent6e6bbcd053c6114a9fa75052b09e701eaa2f3465 (diff)
docs: add spans example
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2683a6d..740d857 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,22 @@ for token in NaiveParser::new(html).flatten() {
assert_eq!(new_html, "<title>hello world</title>");
```
+This library can provide source spans. For an example, see
+[`examples/spans.rs`], which produces the following output:
+
+```output id=spans
+note:
+ ┌─ file.html:1:2
+ │
+1 │ <img src=example.jpg alt="some description">
+ │ ^^^ ^^^ ^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^ attr value
+ │ │ │ │ │
+ │ │ │ │ attr name
+ │ │ │ attr value
+ │ │ attr name
+ │ tag name
+```
+
## Limitations
* This crate does not yet implement tree construction
@@ -63,6 +79,7 @@ Licensed under the MIT license, see [the LICENSE file].
[parsing model]: https://html.spec.whatwg.org/multipage/parsing.html#overview-of-the-parsing-model
+[`examples/spans.rs`]: ./examples/spans.rs
[character encoding detection]: https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding
[html5lib tokenizer test suite]: https://github.com/html5lib/html5lib-tests/tree/master/tokenizer
[html5gum]: https://crates.io/crates/html5gum