summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-18 13:02:23 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-06-18 13:02:23 +0000
commit8451c5ff605ee1e8ec3aa79ac101e2cce7b920f8 (patch)
treeaf7aefc1675c14331ac902a86080a386a8119470
parent3c725a2a5d340a2edae8a79ad6af3a0924cc8f14 (diff)
parentb762fc4b460bed9f0510f19e20130fc331fa1efe (diff)
downloadgitlab-ce-8451c5ff605ee1e8ec3aa79ac101e2cce7b920f8.tar.gz
Merge branch 'dm-blockquote-trailing-whitespace' into 'master'
Allow trailing whitespace on blockquote fence lines See merge request gitlab-org/gitlab-ce!19960
-rw-r--r--changelogs/unreleased/dm-blockquote-trailing-whitespace.yml5
-rw-r--r--lib/banzai/filter/blockquote_fence_filter.rb12
-rw-r--r--spec/lib/banzai/filter/blockquote_fence_filter_spec.rb4
3 files changed, 15 insertions, 6 deletions
diff --git a/changelogs/unreleased/dm-blockquote-trailing-whitespace.yml b/changelogs/unreleased/dm-blockquote-trailing-whitespace.yml
new file mode 100644
index 00000000000..98ecdde4f4c
--- /dev/null
+++ b/changelogs/unreleased/dm-blockquote-trailing-whitespace.yml
@@ -0,0 +1,5 @@
+---
+title: Allow trailing whitespace on blockquote fence lines
+merge_request:
+author:
+type: fixed
diff --git a/lib/banzai/filter/blockquote_fence_filter.rb b/lib/banzai/filter/blockquote_fence_filter.rb
index d2c4b1e4d76..fbfcd72c916 100644
--- a/lib/banzai/filter/blockquote_fence_filter.rb
+++ b/lib/banzai/filter/blockquote_fence_filter.rb
@@ -10,7 +10,7 @@ module Banzai
^```
.+?
- \n```$
+ \n```\ *$
)
|
(?<html>
@@ -19,9 +19,9 @@ module Banzai
# Anything, including `>>>` blocks which are ignored by this filter
# </tag>
- ^<[^>]+?>\n
+ ^<[^>]+?>\ *\n
.+?
- \n<\/[^>]+?>$
+ \n<\/[^>]+?>\ *$
)
|
(?:
@@ -30,14 +30,14 @@ module Banzai
# Anything, including code and HTML blocks
# >>>
- ^>>>\n
+ ^>>>\ *\n
(?<quote>
(?:
# Any character that doesn't introduce a code or HTML block
(?!
^```
|
- ^<[^>]+?>\n
+ ^<[^>]+?>\ *\n
)
.
|
@@ -48,7 +48,7 @@ module Banzai
\g<html>
)+?
)
- \n>>>$
+ \n>>>\ *$
)
}mx.freeze
diff --git a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
index 8224dc5a6b9..b645e49bd43 100644
--- a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
+++ b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb
@@ -11,4 +11,8 @@ describe Banzai::Filter::BlockquoteFenceFilter do
expect(output).to eq(expected)
end
+
+ it 'allows trailing whitespace on blockquote fence lines' do
+ expect(filter(">>> \ntest\n>>> ")).to eq("> test")
+ end
end