Releases: rust-ammonia/ammonia
Releases · rust-ammonia/ammonia
2.0.0
- Add "script" and "style" to the default set of clean content tags
- Make all iterator-accepting APIs use
IntoIteratorandBorrow, so that you can pass slices directly to them.
1.2.0
- Recognize
action,formactionandpingas URL attributes for scheme and origin filtering - Add
Builder::url_filter_mapwhich allows URLs, both relative and absolute, to be pre-filtered
1.1.0
- Add
Builder::clean_content_tagswhich allows elements to be removed entirely instead of just having the tags removed
1.0.1
1.0.0
Migrating
In 0.7 and earlier, you would call Ammonia::clean and get a string out:
let a: String = Ammonia::new().clean(&input);The 1.0 API is more flexible, returning a Document struct that can be written to a writer as well as a string. It's also been renamed from ammonia::Ammonia to ammonia::Builder. So the equivalent is:
let a: Builder = Builder::new().clean(&input).to_string();Changes since 0.7
- Breaking change: The
Ammoniastruct is now calledBuilderand uses that pattern for better forward compatibility - Breaking change: The
Builder::clean()method now returns aDocumentstruct instead of aString(you can use theDocument::to_stringmethod to obtain aString) - Breaking change:
keep_cleaned_elementshas changed from being an off-by-default option to the only supported behavior - Breaking change: Using a tag with
allowed_classesmeans that the class attribute is banned fromtag_attributes(it used to be required) - Breaking change: The default set of allowed elements and attributes was expanded
- Added support for reading the input from a stream
- Added
UrlRelative::Custom, allowing you to write your own relative URL resolver - Changed
UrlRelative::RewriteWithBasetake a custom URL. This made theurlcrate a public dependency. - Added
id_prefix, which can be used to avoid elementidcollisions with the rest of the page - Added property getters to
Builder, to see what everything is currently set to - Added property modifiers, to change the existing whitelist (instead of completely replacing it)
Changes since 1.0-rc3
- Changed over to use
ReadandWriteimplementations directly, instead of using references to them (&mut T where T: ReadimplementsRead, and the same is true forWrite, so the direct version still allows the user to use references, so it's strictly more flexible)
1.0.0-rc3
Changes since RC2:
- Do not run the custom URL resolver on absolute URLs
- Update to html5ever 0.21
1.0.0-rc2
Changes since RC1:
- Breaking change: Expanded the default set of allowed elements and attributes
- Add
UrlRelative::Custom, allowing you to write your own relative URL resolver - Make
UrlRelative::RewriteWithBasetake a custom URL. Also makes theurlcrate a public dependency. - Add
id_prefix, a setting that allows users to specify an ID attribute that cannot collide with page-wide IDs - Add property getters to Builder, to see what everything is currently set to
- Add property modifiers, to change the existing whitelist (instead of completely replacing it)
1.0.0-rc1
- Breaking change: The
Ammoniastruct is now calledBuilderand uses that pattern for better forward compatibility - Breaking change: The
Builder::clean()method now returns aDocumentstruct instead of aString - Breaking change:
keep_cleaned_elementsis changed from being an off-by-default option to the only supported behavior - Breaking change: Using a tag with
allowed_classesmeans that the class attribute is banned fromtag_attributes(it used to be required) - Added support for reading the input from a stream