Merge branch 'sh-revert-markdown-changes' into 'master'
Fix slow Markdown rendering Closes #49409 See merge request gitlab-org/gitlab-ce!20820
This commit is contained in:
commit
d114800241
3 changed files with 18 additions and 1 deletions
5
changelogs/unreleased/sh-revert-markdown-changes.yml
Normal file
5
changelogs/unreleased/sh-revert-markdown-changes.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix slow Markdown rendering
|
||||||
|
merge_request: 20820
|
||||||
|
author:
|
||||||
|
type: performance
|
|
@ -13,7 +13,7 @@ module Banzai
|
||||||
|
|
||||||
def whitelist
|
def whitelist
|
||||||
strong_memoize(:whitelist) do
|
strong_memoize(:whitelist) do
|
||||||
customize_whitelist(super.dup)
|
customize_whitelist(super.deep_dup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,18 @@ describe Banzai::Filter::SanitizationFilter do
|
||||||
expect(instance.whitelist[:transformers].size).to eq control_count
|
expect(instance.whitelist[:transformers].size).to eq control_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'customizes the whitelist only once for different instances' do
|
||||||
|
instance1 = described_class.new('Foo1')
|
||||||
|
instance2 = described_class.new('Foo2')
|
||||||
|
control_count = instance1.whitelist[:transformers].size
|
||||||
|
|
||||||
|
instance1.whitelist
|
||||||
|
instance2.whitelist
|
||||||
|
|
||||||
|
expect(instance1.whitelist[:transformers].size).to eq control_count
|
||||||
|
expect(instance2.whitelist[:transformers].size).to eq control_count
|
||||||
|
end
|
||||||
|
|
||||||
it 'sanitizes `class` attribute from all elements' do
|
it 'sanitizes `class` attribute from all elements' do
|
||||||
act = %q{<pre class="code highlight white c"><code><span class="k">def</span></code></pre>}
|
act = %q{<pre class="code highlight white c"><code><span class="k">def</span></code></pre>}
|
||||||
exp = %q{<pre><code><span class="k">def</span></code></pre>}
|
exp = %q{<pre><code><span class="k">def</span></code></pre>}
|
||||||
|
|
Loading…
Reference in a new issue