summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-04-03 08:42:23 -0500
committerBrett Walker <bwalker@gitlab.com>2019-04-04 18:59:31 -0500
commit949bcb1f8d9695171d0dc88461f6a16800ac57c9 (patch)
tree2716c2263861178b7ddd366f336700d40a73c35a /lib/banzai
parent3ccb4d954f4c51f4f3cc77ebd53f21425e0d4d09 (diff)
downloadgitlab-ce-949bcb1f8d9695171d0dc88461f6a16800ac57c9.tar.gz
Fenced blockquotes to not change source line pos58717-checkbox-cannot-be-checked-if-a-blockquote-is-above
Replaces blockquote fences with \n, keeping the line numbering intact.
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/blockquote_fence_filter.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/banzai/filter/blockquote_fence_filter.rb b/lib/banzai/filter/blockquote_fence_filter.rb
index ad367cc5efe..8f5ad9981e5 100644
--- a/lib/banzai/filter/blockquote_fence_filter.rb
+++ b/lib/banzai/filter/blockquote_fence_filter.rb
@@ -42,7 +42,9 @@ module Banzai
def call
@text.gsub(REGEX) do
if $~[:quote]
- $~[:quote].gsub(/^/, "> ").gsub(/^> $/, ">")
+ # keep the same number of source lines/positions by replacing the
+ # fence lines with newlines
+ "\n" + $~[:quote].gsub(/^/, "> ").gsub(/^> $/, ">") + "\n"
else
$~[0]
end