Commit 0fccee82b71346e35196533e0052a77a4ed19935

Authored by Dmitriy Zaporozhets
1 parent 9b1b5aee

Dont parse gfm-extractions as commit. Increase gfm rendering speed. Especially f…

…or a lot of code snippets
Showing 1 changed file with 4 additions and 0 deletions   Show diff stats
lib/gitlab/markdown.rb
@@ -101,6 +101,7 @@ module Gitlab @@ -101,6 +101,7 @@ module Gitlab
101 |!(?<merge_request>\d+) # MR ID 101 |!(?<merge_request>\d+) # MR ID
102 |\$(?<snippet>\d+) # Snippet ID 102 |\$(?<snippet>\d+) # Snippet ID
103 |(?<commit>[\h]{6,40}) # Commit ID 103 |(?<commit>[\h]{6,40}) # Commit ID
  104 + |(?<skip>gfm-extraction-[\h]{6,40}) # Skip gfm extractions. Otherwise will be parsed as commit
104 ) 105 )
105 (?<suffix>\W)? # Suffix 106 (?<suffix>\W)? # Suffix
106 }x.freeze 107 }x.freeze
@@ -113,6 +114,9 @@ module Gitlab @@ -113,6 +114,9 @@ module Gitlab
113 prefix = $~[:prefix] 114 prefix = $~[:prefix]
114 suffix = $~[:suffix] 115 suffix = $~[:suffix]
115 type = TYPES.select{|t| !$~[t].nil?}.first 116 type = TYPES.select{|t| !$~[t].nil?}.first
  117 +
  118 + next unless type
  119 +
116 identifier = $~[type] 120 identifier = $~[type]
117 121
118 # Avoid HTML entities 122 # Avoid HTML entities