Crates.io | is-html |
lib.rs | is-html |
version | 0.1.3 |
source | src |
created_at | 2022-05-05 14:14:49.623248 |
updated_at | 2022-05-11 14:27:41.394426 |
description | Check if a string is HTML |
homepage | |
repository | |
max_upload_size | |
id | 581030 |
size | 5,564 |
Check if a string is HTML
You should not use this for any kind of validation, sanitation, or XSS checks.
$ cargo install is-html
This crate is on crates.io and can be used by adding is-html to your dependencies in your project’s Cargo.toml.
[dependencies]
is-html = "0.1.2"
use is_html::is_html;
is_html("<p>I am HTML</p>");
//=> true
is_html("<!doctype><html><body><h1>I ❤ rust</h1></body></html>");
//=> true
is_html("<cake>I am XML</cake>");
//=> false
is_html(">+++++++>++++++++++>+++>+<<<<-");
//=> false
Note: It does not detect deprecated HTML tags.