Commit 4bb41c5e authored by Yorick Peterse's avatar Yorick Peterse

Merge branch '18592-syntaxhighlighter-slow' into 'master'

Specific metrics for code on Banzai::Filter::SyntaxHighlightFilter

See merge request !5038
parents b569f842 52145483
......@@ -27,6 +27,7 @@ v 8.10.0 (unreleased)
- Better caching of git calls on ProjectsController#show.
- Add API endpoint for a group issues !4520 (mahcsig)
- Add Bugzilla integration !4930 (iamtjg)
- Metrics for Rouge::Plugins::Redcarpet and Rouge::Formatters::HTMLGitlab
- Allow [ci skip] to be in any case and allow [skip ci]. !4785 (simon_w)
- Add basic system information like memory and disk usage to the admin panel
......
......@@ -132,6 +132,9 @@ if Gitlab::Metrics.enabled?
config.instrument_instance_methods(API::Helpers)
config.instrument_instance_methods(RepositoryCheck::SingleRepositoryWorker)
config.instrument_instance_methods(Rouge::Plugins::Redcarpet)
config.instrument_instance_methods(Rouge::Formatters::HTMLGitlab)
end
GC::Profiler.enable
......
......@@ -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(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment