summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-10-04 16:22:36 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-10-04 16:22:36 +0000
commit7887a3dafb6902cc39c831e307c48faf49f80b51 (patch)
tree36b4e4af36e72c522b0cf40582fdb824fb546f3b /lib
parentc38b85f37be87b64c08669aebacea4def6396911 (diff)
parentf377f82651998dc56301cc6540867b5120da43f2 (diff)
downloadgitlab-ce-7887a3dafb6902cc39c831e307c48faf49f80b51.tar.gz
Merge branch 'code-blocks-vue-pre' into 'master'
Adds v-pre to code blocks in comments ## What does this MR do? Allows users to comment on discussions with code that contains `{{` Previously because of the discussion part being a Vue app it was being converted by Vue & therefore creating JS errors & the code not displaying correctly. This adds `v-pre` onto the code element to allow the user to write code that would contain `{{` ## What are the relevant issue numbers? Closes #22911 See merge request !6674
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/sanitization_filter.rb2
-rw-r--r--lib/banzai/filter/syntax_highlight_filter.rb2
2 files changed, 2 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..026b81ac175 100644
--- a/lib/banzai/filter/syntax_highlight_filter.rb
+++ b/lib/banzai/filter/syntax_highlight_filter.rb
@@ -30,7 +30,7 @@ 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>)
# Extracted to a method to measure it
replace_parent_pre_element(node, highlighted)