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

inline_diff_markdown_marker.rb « diff « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8d596ebce71e7b7c52d6ebb07165326fea4caa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

module Gitlab
  module Diff
    class InlineDiffMarkdownMarker < Gitlab::StringRangeMarker
      MARKDOWN_SYMBOLS = {
        addition: "+",
        deletion: "-"
      }.freeze

      def mark(line_inline_diffs)
        super(line_inline_diffs) do |text, left:, right:, mode:|
          symbol = MARKDOWN_SYMBOLS[mode]
          "{#{symbol}#{text}#{symbol}}"
        end
      end
    end
  end
end