askama/askama_escape
dependabot[bot] f0a1fa467d build(deps): update criterion requirement from 0.6 to 0.7
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.6.0...0.7.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-25 23:36:35 +02:00
..
2025-05-18 23:06:41 +02:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00
2025-03-21 22:45:25 +01:00

askama_escape: HTML escaping, extracted from Askama

Crates.io GitHub Workflow Status docs.rs

Useful if you don't need a template engine, but if you need to escape a text for HTML or XML.

This implementation escapes '"', '&', '\'', '<' and '>'.

Example

use askama_escape::{escape, escape_html, escape_html_char, Html};

assert_eq!(
    escape("<script>alert('Hello & bye!')</script>", Html).to_string(),
    "&#60;script&#62;alert(&#39;Hello &#38; bye!&#39;)&#60;/script&#62;",
);

let mut dest = String::new();
escape_html(&mut dest, "<script>alert('Hello & bye!')</script>").unwrap();
assert_eq!(
    dest,
    "&#60;script&#62;alert(&#39;Hello &#38; bye!&#39;)&#60;/script&#62;",
);

let mut dest = String::new();
escape_html_char(&mut dest, '&').unwrap();
assert_eq!(dest, "&#38;");