summaryrefslogtreecommitdiff
path: root/lib/banzai/filter
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-10-04 14:06:44 +0100
committerPhil Hughes <me@iamphill.com>2016-10-04 14:06:44 +0100
commit138e26b1fad6730aa048b8cc91f92a597e323162 (patch)
tree1f71f38a5811ca10846225ded637ffbb11258322 /lib/banzai/filter
parent796f531f2b4de62eac3db41835e56080520eaa48 (diff)
downloadgitlab-ce-138e26b1fad6730aa048b8cc91f92a597e323162.tar.gz
Adds v-pre to code blocks in comments
Closes #22911
Diffstat (limited to 'lib/banzai/filter')
-rw-r--r--lib/banzai/filter/sanitization_filter.rb2
-rw-r--r--lib/banzai/filter/syntax_highlight_filter.rb3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/banzai/filter/sanitization_filter.rb b/lib/banzai/filter/sanitization_filter.rb
index 2470362e019..af1e575fc89 100644
--- a/lib/banzai/filter/sanitization_filter.rb
+++ b/lib/banzai/filter/sanitization_filter.rb
@@ -25,7 +25,7 @@ module Banzai
return if customized?(whitelist[:transformers])
# Allow code highlighting
- whitelist[:attributes]['pre'] = %w(class)
+ whitelist[:attributes]['pre'] = %w(class v-pre)
whitelist[:attributes]['span'] = %w(class)
# Allow table alignment
diff --git a/lib/banzai/filter/syntax_highlight_filter.rb b/lib/banzai/filter/syntax_highlight_filter.rb
index fcdb496aed2..bb6b4582e4f 100644
--- a/lib/banzai/filter/syntax_highlight_filter.rb
+++ b/lib/banzai/filter/syntax_highlight_filter.rb
@@ -30,7 +30,8 @@ module Banzai
# users can still access an issue/comment/etc.
end
- highlighted = %(<pre class="#{css_classes}"><code>#{code}</code></pre>)
+ highlighted = %(<pre class="#{css_classes}" v-pre="true"><code>#{code}</code></pre>)
+ puts highlighted
# Extracted to a method to measure it
replace_parent_pre_element(node, highlighted)