diff --git a/config/feature_flags/development/markdown_corrected_blockquote.yml b/config/feature_flags/development/markdown_corrected_blockquote.yml deleted file mode 100644 index 8b02ef6ec0aba0d672c486ca49bb68ca712c9f64..0000000000000000000000000000000000000000 --- a/config/feature_flags/development/markdown_corrected_blockquote.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: markdown_corrected_blockquote -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95967 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372089 -milestone: '15.4' -type: development -group: group::project management -default_enabled: false diff --git a/lib/banzai/filter/blockquote_fence_filter.rb b/lib/banzai/filter/blockquote_fence_filter.rb index fbc020bd20e6f961dfe20e66e996aad89456292d..e5cf20d00df2835adcc65c0cc7c62ca32205537b 100644 --- a/lib/banzai/filter/blockquote_fence_filter.rb +++ b/lib/banzai/filter/blockquote_fence_filter.rb @@ -34,44 +34,13 @@ class BlockquoteFenceFilter < HTML::Pipeline::TextFilter ) }mx.freeze - OLD_REGEX = %r{ - #{::Gitlab::Regex.markdown_code_or_html_blocks} - | - (?=^>>>\ *\n.*\n>>>\ *$)(?: - # Blockquote: - # >>> - # Anything, including code and HTML blocks - # >>> - - ^>>>\ *\n - (?<quote> - (?: - # Any character that doesn't introduce a code or HTML block - (?! - ^``` - | - ^<[^>]+?>\ *\n - ) - . - | - # A code block - \g<code> - | - # An HTML block - \g<html> - )+? - ) - \n>>>\ *$ - ) - }mx.freeze - def initialize(text, context = nil, result = nil) super text, context, result @text = @text.delete("\r") end def call - @text.gsub(regex) do + @text.gsub(REGEX) do if $~[:quote] # keep the same number of source lines/positions by replacing the # fence lines with newlines @@ -81,12 +50,6 @@ def call end end end - - private - - def regex - Feature.enabled?(:markdown_corrected_blockquote) ? REGEX : OLD_REGEX - end end end end diff --git a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb index 36e8002b796cb6e80047162fd58ce3cfae648f3d..5712ed7da1f0be0d521ba75ad16c6663c0a7d094 100644 --- a/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb +++ b/spec/lib/banzai/filter/blockquote_fence_filter_spec.rb @@ -22,14 +22,6 @@ expect(filter(">>> \ntest\n>>> ")).to eq("\n> test\n") end - context 'when feature flag is turned off' do - it 'does not require a leading or trailing blank line' do - stub_feature_flags(markdown_corrected_blockquote: false) - - expect(filter("Foo\n>>>\ntest\n>>>\nBar")).to eq("Foo\n\n> test\n\nBar") - end - end - context 'when incomplete blockquote fences with multiple blocks are present' do it 'does not raise timeout error' do test_string = ">>>#{"\n```\nfoo\n```" * 20}"