Releases: flavorjones/loofah
2.24.1 / 2025-05-12
2.24.1 / 2025-05-12
Ruby support
- Import only what's needed from
cgifor support for Ruby 3.5 #296 @Earlopain
2.24.0 / 2024-12-24
2.24.0 / 2024-12-24
Added
- Built-in scrubber
:double_breakpointwhich sees<br><br>and wraps the surrounding content in<p>tags. #279, #284 @josecolella @torihuang
Improved
- Built-in scrubber
:targetblanknow skipsatags whosehrefattribute is an anchor link. Previously, allatags were modified to havetarget='_blank'. #291 @fnando
New Contributors
- @andrew made their first contribution in #289
- @fnando made their first contribution in #291
- @josecolella and @torihuang made their first contribution in #284
Full Changelog: v2.23.1...v2.24.0
2.23.1 / 2024-10-25
2.23.0 / 2024-10-24
2.23.0 / 2024-10-24
Added
New Contributors
- @m-nakamura145 made their first contribution in #280
- @lazyatom made their first contribution in #287
Full Changelog: v2.22.0...v2.23.0
2.22.0 / 2023-11-13
2.22.0 / 2023-11-13
Added
- A
:targetblankHTML scrubber which ensures all hyperlinks havetarget="_blank". [#275] @stefannibrasil and @thdaraujo - A
:noreferrerHTML scrubber which ensures all hyperlinks haverel=noreferrer, similar to the:nofollowand:noopenerscrubbers. [#277] @wynksaiddestroy
2.21.4 / 2023-10-10
2.21.3 / 2023-05-15
2.21.3 / 2023-05-15
- Quash "instance variable not initialized" warning in Ruby < 3.0. [#268] (Thanks, @dharamgollapudi!)
2.21.2 / 2023-05-11
2.21.2 / 2023-05-11
Dependencies
- Update the dependency on Nokogiri to be
>= 1.12.0. The dependency in 2.21.0 and 2.21.1 was left at>= 1.5.9but versions before 1.12 would result in aNameErrorexception. [#266]
2.21.1 / 2023-05-10
2.21.1 / 2023-05-10
Fixed
- Don't define
HTML5::DocumentandHTML5::DocumentFragmentwhen Nokogiri is< 1.14. In 2.21.0 these classes were defined wheneverNokogiri::HTML5was defined, but Nokogiri v1.12 and v1.13 do not support Loofah subclassing properly.
2.21.0 / 2023-05-10
2.21.0 / 2023-05-10
HTML5 Support
Classes Loofah::HTML5::Document and Loofah::HTML5::DocumentFragment are introduced, along with helper methods:
Loofah.html5_documentLoofah.html5_fragmentLoofah.scrub_html5_documentLoofah.scrub_html5_fragment
These classes and methods use Nokogiri's HTML5 parser to ensure modern web standards are used.
⚠ HTML5 functionality is only available with Nokogiri v1.14.0 and higher.
⚠ HTML5 functionality is not available for JRuby. Please see this upstream Nokogiri issue if you're interested in helping implement and support HTML5 support.
Loofah::HTML4 module and namespace
Loofah::HTML has been renamed to Loofah::HTML4, and Loofah::HTML is aliased to preserve backwards-compatibility. Nokogiri::HTML and Nokogiri::HTML4 parse methods still use libxml2's (or NekoHTML's) HTML4 parser.
Take special note that if you rely on the class name of an object in your code, objects will now report a class of Loofah::HTML4::Foo where they previously reported Loofah::HTML::Foo. Instead of relying on the string returned by Object#class, prefer Class#=== or Object#is_a? or Object#instance_of?.
Future releases of Nokogiri may deprecate HTML classes and methods or otherwise change this behavior, so please start using HTML4 in place of HTML.
Official support for JRuby
This version introduces official support for JRuby. Previously, the test suite had never been green due to differences in behavior in the underlying HTML parser used by Nokogiri. We've updated the test suite to accommodate those differences, and have added JRuby to the CI suite.