summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-06-27 17:50:42 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-06-27 19:18:08 -0300
commitad7fcc7b8e7c6e4eb9b02de243fd1a739991ac38 (patch)
tree09bc0ae29c4c3e08304c99ab6d6a606bbcfa5e3c /lib/banzai
parent07de43a7e07cefcbb60e7ed84c684f478eae8b93 (diff)
downloadgitlab-ce-ad7fcc7b8e7c6e4eb9b02de243fd1a739991ac38.tar.gz
Use monospaced font for MR diff commit link ref on GFM
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/merge_request_reference_filter.rb5
-rw-r--r--lib/banzai/filter/reference_filter.rb8
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/banzai/filter/merge_request_reference_filter.rb b/lib/banzai/filter/merge_request_reference_filter.rb
index 5cbdb01c130..10c40568006 100644
--- a/lib/banzai/filter/merge_request_reference_filter.rb
+++ b/lib/banzai/filter/merge_request_reference_filter.rb
@@ -25,7 +25,10 @@ module Banzai
extras = super
if commit_ref = object_link_commit_ref(object, matches)
- return extras.unshift(commit_ref)
+ klass = reference_class(:commit, tooltip: false)
+ commit_ref_tag = %(<span class="#{klass}">#{commit_ref}</span>)
+
+ return extras.unshift(commit_ref_tag)
end
path = matches[:path] if matches.names.include?("path")
diff --git a/lib/banzai/filter/reference_filter.rb b/lib/banzai/filter/reference_filter.rb
index 2f023f4f242..2411dd2cdfc 100644
--- a/lib/banzai/filter/reference_filter.rb
+++ b/lib/banzai/filter/reference_filter.rb
@@ -65,8 +65,12 @@ module Banzai
context[:skip_project_check]
end
- def reference_class(type)
- "gfm gfm-#{type} has-tooltip"
+ def reference_class(type, tooltip: true)
+ gfm_klass = "gfm gfm-#{type}"
+
+ return gfm_klass unless tooltip
+
+ "#{gfm_klass} has-tooltip"
end
# Ensure that a :project key exists in context