summaryrefslogtreecommitdiff
path: root/lib/banzai/filter/syntax_highlight_filter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/banzai/filter/syntax_highlight_filter.rb')
-rw-r--r--lib/banzai/filter/syntax_highlight_filter.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/banzai/filter/syntax_highlight_filter.rb b/lib/banzai/filter/syntax_highlight_filter.rb
index 62a79c62e20..536b478979f 100644
--- a/lib/banzai/filter/syntax_highlight_filter.rb
+++ b/lib/banzai/filter/syntax_highlight_filter.rb
@@ -27,12 +27,17 @@ module Banzai
highlighted = "<pre>#{code}</pre>"
end
- # Replace the parent `pre` element with the entire highlighted block
- node.parent.replace(highlighted)
+ # Extracted to a method to measure it
+ replace_parent_pre_element(node, highlighted)
end
private
+ def replace_parent_pre_element(node, highlighted)
+ # Replace the parent `pre` element with the entire highlighted block
+ node.parent.replace(highlighted)
+ end
+
# Override Rouge::Plugins::Redcarpet#rouge_formatter
def rouge_formatter(lexer)
Rouge::Formatters::HTMLGitlab.new(