Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb')
-rw-r--r--spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb b/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb
index 5021ef3a79a..303d0fcb6c2 100644
--- a/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb
+++ b/spec/lib/banzai/pipeline/pre_process_pipeline_spec.rb
@@ -32,4 +32,21 @@ RSpec.describe Banzai::Pipeline::PreProcessPipeline do
expect(result[:output]).to eq('foo foo f...')
end
+
+ context 'when multiline blockquote' do
+ it 'data-sourcepos references correct line in source markdown' do
+ markdown = <<~MD
+ >>>
+ foo
+ >>>
+ MD
+
+ pipeline_output = described_class.call(markdown, {})[:output]
+ pipeline_output = Banzai::Pipeline::PlainMarkdownPipeline.call(pipeline_output, {})[:output]
+ sourcepos = pipeline_output.at('blockquote')['data-sourcepos']
+ source_line = sourcepos.split(':').first.to_i
+
+ expect(markdown.lines[source_line - 1]).to eq "foo\n"
+ end
+ end
end