Skip to content

Refactor truncate_visible into a Banzai filter, TruncateVisibleFilter

Brett Walker requested to merge bw-truncate-visible-filter into master

What does this MR do and why?

The truncate_visible code in markup_helper.rb is run right before the post_process pipeline is run. It takes html output from the Banzai pipeline, creates a new Nokogiri document, processes it, converts back to html, and then passes to post_process pipeline. Which again converts it into a Nokogiri doc, etc.

It's more efficient to have a Banzai filter that operates on the already created document, and add it to the post_process pipeline. This also gets the code out of a view helper.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Brett Walker

Merge request reports