Filter to cleaning up malformed and faulty HTML via the JSoup lib.


Magnolia CE/EE 5.3+




This Module will not work with Magnolia 5.4.x until you bypass DAM and imaging. Download settings below or add it by yourself. Magnolia 5.4.x versions will be available at the magnolia marketplace.


or add it by yourself:

What is getting installed

The module installs a new Filter below the Cache Filter.

By Default the Filter is not enabled


Without Tidy FilterWith Tidy Filter enabled





Version History


  • First Release


  • Tested with Magnolia 5.3. The Module is now not anymore depend on Magnolia 5.3.6+



  • Vivian Steller from lemonize: he originally programmed this filter
  • Gregory Joseph from Magnolia for helping with Maven and Forge




  • No labels


  1. @tomwespi thanks for your efforts releasing the module!

  2. Hi Vivian Steller, thanks for the module. Trying to install using Magnolia 5.5.5.

    So far everything logs good. But got the problem that the content type of the response is null. Means your filter does not do anything. The sequence of my filters looks same as in your documentation. Any idea what may go wrong? Ever tested with Magnolia 5.5?

    1. Hi

      Is the filter enabled? Not tested with 5.5.x

      1. Yes, filter is enabled. Problem is that response.getContentType() resolves to null.

        If modifying the code filter works fine and HTML gets well formatted.

        1. Ah yes, there was some change, I did also some local changes but its not committed:

          public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
              BufferedHttpResponseWrapper wrappedResponse = new BufferedHttpResponseWrapper(response);
              String extension = MgnlContext.getAggregationState().getExtension();
              // We assume it is a html page when no extension is set
              if (extension.isEmpty()) {
                  extension = DEFAULT_EXTENSION;
              boolean doNormalFilter = true;
              if (extension.equalsIgnoreCase(DEFAULT_EXTENSION)) {
                  chain.doFilter(request, wrappedResponse);
                  cleanupHtml(wrappedResponse, response);
                  doNormalFilter = false;
              if (doNormalFilter) {
                  chain.doFilter(request, response);
  3. Thanks! First view - it works. Can you please update Maven/Nexus repo?

  4. Hi Tom Wespi, another point... We actived the filter; basically everything fine and working.

    But then I recognized that specials chars (e.g. äöü) become corrupt. We use normal UTF-8 settings. Without filter all chars are fine. Any idea?

    1. It has probably something to do with your JVM or your system setting, check if everywhere UTF-8 is set. I will also ask my hosting provider, we had this problem but solved it quite a time ago

  5. Hi Tom Wespiis this module still active? Which Magnolia versions does it support? I'd like to add support badges to it - like in the other modules if it is still active.