diff options
author | Martin Fischer <martin@push-f.com> | 2023-09-03 23:02:01 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:02:01 +0200 |
commit | 0c590e90564870fa8600460c866c7395b7d865cd (patch) | |
tree | d702e200ed5b815a32b6bbd3cf7c6e8c5c370c9c /README.md | |
parent | 6e6bbcd053c6114a9fa75052b09e701eaa2f3465 (diff) |
docs: add spans example
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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 |