HTML Escape
This library is for encoding/escaping special characters in HTML and decoding/unescaping HTML entities as well.
Usage
Encoding
This crate provides some encode_*
functions to encode HTML text in different situations.
For example, to put a text between a start tag <foo>
and an end tag </foo>
, use the encode_text
function to escape every &
, <
, and >
in the text.
extern crate html_escape;
assert_eq!;
The functions suffixed with _to_writer
, _to_vec
or _to_string
are useful to generate HTML.
extern crate html_escape;
let mut html = String from;
assert_eq!;
html.push_str;
assert_eq!;
html.push_str;
assert_eq!;
html.push_str;
assert_eq!;
Decoding
extern crate html_escape;
let mut html = String from;
assert_eq!;
extern crate html_escape;
let mut html = String from;
assert_eq!;
No Std
Disable the default features to compile this crate without std.
[]
= "*"
= false
Benchmark
Crates.io
https://crates.io/crates/html-escape