Skip to content

Releases: rust-ammonia/ammonia

2.0.0

28 Dec 19:51

Choose a tag to compare

  • Add "script" and "style" to the default set of clean content tags
  • Make all iterator-accepting APIs use IntoIterator and Borrow, so that you can pass slices directly to them.

1.2.0

18 Jul 20:49

Choose a tag to compare

1.1.0

04 Mar 21:17

Choose a tag to compare

1.0.1

24 Dec 17:56

Choose a tag to compare

  • Bump dependencies

1.0.0

12 Nov 16:56

Choose a tag to compare

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 Ammonia struct is now called Builder and uses that pattern for better forward compatibility
  • Breaking change: The Builder::clean() method now returns a Documentstruct instead of a String (you can use the Document::to_string method to obtain a String)
  • Breaking change: keep_cleaned_elements has changed from being an off-by-default option to the only supported behavior
  • Breaking change: Using a tag with allowed_classes means that the class attribute is banned from tag_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::RewriteWithBase take a custom URL. This made the url crate a public dependency.
  • Added id_prefix, which can be used to avoid element id collisions 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 Read and Write implementations directly, instead of using references to them (&mut T where T: Read implements Read, and the same is true for Write, so the direct version still allows the user to use references, so it's strictly more flexible)

1.0.0-rc3

26 Oct 20:45

Choose a tag to compare

1.0.0-rc3 Pre-release
Pre-release

Changes since RC2:

  • Do not run the custom URL resolver on absolute URLs
  • Update to html5ever 0.21

1.0.0-rc2

24 Oct 19:41

Choose a tag to compare

1.0.0-rc2 Pre-release
Pre-release

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::RewriteWithBase take a custom URL. Also makes the url crate 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

26 Sep 13:50

Choose a tag to compare

1.0.0-rc1 Pre-release
Pre-release
  • Breaking change: The Ammonia struct is now called Builder and uses that pattern for better forward compatibility
  • Breaking change: The Builder::clean() method now returns a Document struct instead of a String
  • Breaking change: keep_cleaned_elements is changed from being an off-by-default option to the only supported behavior
  • Breaking change: Using a tag with allowed_classes means that the class attribute is banned from tag_attributes (it used to be required)
  • Added support for reading the input from a stream

0.7.0

05 Sep 17:56

Choose a tag to compare

  • Add allowed_classes, allowing the user to set only specific items that can go in the class attribute
  • Fix a bug in the traversal code (also backported to v0.6.1)

0.6.1

05 Sep 17:55

Choose a tag to compare

  • Fix a bug in the traversal code (backport from 0.7.0)