2 unstable releases

0.2.0 Jan 6, 2024
0.1.0 Jan 6, 2024

#2984 in Parser implementations


Used in 2 crates (via ahref)

MIT license

5KB

Tagparser

Extract any html tags from html page

Installation

You can install Ahref using cargo:

cargo add tagparser

Usage

Here's an example of how to use Tagparser lib:

use tagparser::Parser;

fn main() {
    let html = "<a href='https://github.com/tenqz'>Test link</a><p>test p tag</p>".to_string();
    let mut parser = Parser::new(html);
    println!("{:?}", parser.parse_tags("a".to_string()));
    println!("{:?}", parser.parse_tags("p".to_string()));
}

As a result, all "a" and "p" tags will be displayed.

["<a href='https://github.com/tenqz'>Test link</a>"]
["<p>test p tag</p>"]

Dependencies

~2–3MB
~53K SLoC