diff options
author | Phil Hughes <me@iamphill.com> | 2016-10-04 16:06:44 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-10-04 16:06:44 +0300 |
commit | 138e26b1fad6730aa048b8cc91f92a597e323162 (patch) | |
tree | 1f71f38a5811ca10846225ded637ffbb11258322 /lib | |
parent | 796f531f2b4de62eac3db41835e56080520eaa48 (diff) |
Adds v-pre to code blocks in comments
Closes #22911
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/sanitization_filter.rb | 2 | ||||
-rw-r--r-- | lib/banzai/filter/syntax_highlight_filter.rb | 3 |
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) |