Prevent result of SyntaxHighlightFilter being sanitized
This commit is contained in:
parent
b2f3d024c3
commit
7cbf5e4d18
|
@ -67,12 +67,16 @@ module Gitlab
|
|||
|
||||
def clean_spans
|
||||
lambda do |env|
|
||||
return unless env[:node_name] == 'span'
|
||||
return unless env[:node].has_attribute?('class')
|
||||
node = env[:node]
|
||||
|
||||
unless has_ancestor?(env[:node], 'pre')
|
||||
env[:node].remove_attribute('class')
|
||||
return unless node.name == 'span'
|
||||
return unless node.has_attribute?('class')
|
||||
|
||||
unless has_ancestor?(node, 'pre')
|
||||
node.remove_attribute('class')
|
||||
end
|
||||
|
||||
{node_whitelist: [node]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue