gitlab_kramdown 0.13.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -15
- data/LICENSE.txt +1 -1
- data/README.md +2 -1
- data/lib/gitlab_kramdown/converter/gitlab_html.rb +37 -8
- data/lib/gitlab_kramdown/parser/label.rb +48 -0
- data/lib/gitlab_kramdown/parser/reference.rb +90 -36
- data/lib/gitlab_kramdown/parser.rb +1 -0
- data/lib/gitlab_kramdown/version.rb +1 -1
- data/lib/kramdown/parser/gitlab_kramdown.rb +1 -0
- metadata +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd726d2ca05265f3dc10e348b0bf87d7ae76311b781edf33ed14eb4d8180681d
|
4
|
+
data.tar.gz: 232a0e2a3596e476d77c451c307c5940a91175a96af81af2faa9af0f9ab6e11d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c1a69ad95676834697382a26b454f16117f7a76472b5524ab740a6ed6dcdb1268b365975933efaa21f9c173e7dba53f32e4d469b678a99f66d05370a6c1ea5d
|
7
|
+
data.tar.gz: 1ed074519f3f46d3bccc005388668b36dff7a9350e33d3579eaed77662c892453f9981c4e278dbe291436e6f86a62260a4dc09215c146e539ce8c8b29c62dbd1
|
data/CHANGELOG.md
CHANGED
@@ -7,11 +7,43 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
-
|
10
|
+
## [0.17.0] - 2022-02-10
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Add support for making PlantUML images a clickable link
|
15
|
+
|
16
|
+
## [0.16.0] - 2022-01-24
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Namespaced References are correctly extracted when `autolink: false`
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Update minimum supported Ruby to 2.7.5
|
25
|
+
- Labels are now converted to an HTML similar to GitLab
|
26
|
+
- Labels were extracted to its own parser module
|
27
|
+
|
28
|
+
## [0.15.0] - 2021-12-20
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
|
32
|
+
- Update Gem dependencies.
|
33
|
+
|
34
|
+
## [0.14.0] - 2021-08-10
|
35
|
+
|
36
|
+
### Changed
|
37
|
+
|
38
|
+
- Update Gem dependencies. In particular, update Nokogiri to version 1.12.x.
|
39
|
+
|
40
|
+
## [0.13.0] - 2021-07-02
|
41
|
+
|
42
|
+
### Changed
|
11
43
|
|
12
44
|
- Update Gem dependencies
|
13
45
|
|
14
|
-
## [0.12.0]
|
46
|
+
## [0.12.0] - 2021-03-22
|
15
47
|
|
16
48
|
### Changed
|
17
49
|
|
@@ -130,16 +162,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
130
162
|
- Special GitLab References
|
131
163
|
- Multiline Blockquote
|
132
164
|
|
133
|
-
[0.
|
134
|
-
[0.
|
135
|
-
[0.
|
136
|
-
[0.
|
137
|
-
[0.
|
138
|
-
[0.
|
139
|
-
[0.
|
140
|
-
[0.
|
141
|
-
[0.
|
142
|
-
[0.
|
143
|
-
[0.
|
144
|
-
[0.
|
145
|
-
[0.
|
165
|
+
[0.16.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.15.0...v0.16.0
|
166
|
+
[0.15.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.14.0...v0.15.0
|
167
|
+
[0.14.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.13.0...v0.14.0
|
168
|
+
[0.13.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.12.0...v0.13.0
|
169
|
+
[0.12.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.11.0...v0.12.0
|
170
|
+
[0.11.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.10.0...v0.11.0
|
171
|
+
[0.10.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.9.0...v0.10.0
|
172
|
+
[0.9.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.8.0...v0.9.0
|
173
|
+
[0.8.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.7.0...v0.8.0
|
174
|
+
[0.7.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.6.0...v0.7.0
|
175
|
+
[0.6.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.5.0...v0.6.0
|
176
|
+
[0.5.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.4.2...v0.5.0
|
177
|
+
[0.4.2]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.4.1...v0.4.2
|
178
|
+
[0.4.1]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.4.0...v0.4.1
|
179
|
+
[0.4.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.3.0...v0.4.0
|
180
|
+
[0.3.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.2.0...v0.3.0
|
181
|
+
[0.2.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/v0.1.0...v0.2.0
|
182
|
+
[0.1.0]: https://gitlab.com/gitlab-org/gitlab_kramdown/-/compare/15b5e4b46aa0e42974ec2e5ee36c68d97219736f...v0.1.0
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2018-
|
3
|
+
Copyright (c) 2018-2022 Gabriel Mazetto
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -74,6 +74,7 @@ Kramdown::Document.new(source, input: 'GitlabKramdown', syntax_highlighter: :rou
|
|
74
74
|
## Supported and tested Ruby versions
|
75
75
|
|
76
76
|
- Ruby 2.7
|
77
|
+
- Ruby 3.0
|
77
78
|
|
78
79
|
## Release a new version
|
79
80
|
|
@@ -96,7 +97,7 @@ To release a new version of GitLab Kramdown:
|
|
96
97
|
|
97
98
|
## Copyright
|
98
99
|
|
99
|
-
Copyright (c) 2018-
|
100
|
+
Copyright (c) 2018-2022 Gabriel Mazetto. See LICENSE.txt for
|
100
101
|
further details.
|
101
102
|
|
102
103
|
[GitLab flavored Markdown]: https://docs.gitlab.com/ee/user/markdown.html
|
@@ -33,13 +33,7 @@ module GitlabKramdown
|
|
33
33
|
when 'mermaid'
|
34
34
|
%(<div class="mermaid">#{element.value}</div>\n)
|
35
35
|
when 'plantuml'
|
36
|
-
|
37
|
-
|
38
|
-
img_tag = Nokogiri::HTML::DocumentFragment.parse(
|
39
|
-
Asciidoctor::PlantUml::Processor.plantuml_content(element.value, {})
|
40
|
-
)
|
41
|
-
|
42
|
-
%(#{img_tag}\n)
|
36
|
+
render_plantuml(element)
|
43
37
|
else
|
44
38
|
super
|
45
39
|
end
|
@@ -66,7 +60,42 @@ module GitlabKramdown
|
|
66
60
|
|
67
61
|
href = element.attr['src']
|
68
62
|
|
69
|
-
|
63
|
+
img_with_clickable_link(href, super)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Label element is generated by the GitlabKramdown parser, representing GitLab labels
|
67
|
+
#
|
68
|
+
# It includes the following attributes:
|
69
|
+
# - +href+: the URL for the label
|
70
|
+
# - +label+: the name of the label without namespace part
|
71
|
+
# - +namespace+: the namespace part of the label
|
72
|
+
def convert_label(element, _indent)
|
73
|
+
label_attrs = { class: 'badge color-label' }
|
74
|
+
|
75
|
+
label_text = "#{element.attr['label']} in <i>#{element.attr['namespace']}</i>"
|
76
|
+
span_tag = format_as_span_html(:span, label_attrs, label_text)
|
77
|
+
|
78
|
+
format_as_span_html(:a, { 'href' => element.attr['href'] }, span_tag)
|
79
|
+
end
|
80
|
+
|
81
|
+
def img_with_clickable_link(href, img_html)
|
82
|
+
%(<a class="no-attachment-icon" href="#{href}" target="_blank" rel="noopener noreferrer">#{img_html}</a>)
|
83
|
+
end
|
84
|
+
|
85
|
+
def render_plantuml(element)
|
86
|
+
plantuml_setup
|
87
|
+
|
88
|
+
img_tag = Nokogiri::HTML::DocumentFragment.parse(
|
89
|
+
Asciidoctor::PlantUml::Processor.plantuml_content(element.value, {})
|
90
|
+
)
|
91
|
+
|
92
|
+
if @clickable_images
|
93
|
+
href = img_tag.at('img').attr('src')
|
94
|
+
|
95
|
+
"#{img_with_clickable_link(href, img_tag)}\n"
|
96
|
+
else
|
97
|
+
%(#{img_tag}\n)
|
98
|
+
end
|
70
99
|
end
|
71
100
|
end
|
72
101
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GitlabKramdown
|
4
|
+
module Parser
|
5
|
+
# GitLab Labels
|
6
|
+
#
|
7
|
+
# This parser implements non context-specific label references as described
|
8
|
+
# in the GitLab Flavored Markdown reference
|
9
|
+
#
|
10
|
+
# @see https://docs.gitlab.com/ee/user/markdown.html#special-gitlab-references
|
11
|
+
module Label
|
12
|
+
PROJECT_LABEL_PATTERN = %r{
|
13
|
+
#{Regexp.escape('~')}
|
14
|
+
(?<label>
|
15
|
+
[A-Za-z0-9_\-?.&]+ | # String-based single-word label title, or
|
16
|
+
".+?" # String-based multi-word label surrounded in quotes
|
17
|
+
)
|
18
|
+
}x.freeze
|
19
|
+
|
20
|
+
def self.included(klass)
|
21
|
+
klass.define_parser(:label, PROJECT_LABEL_PATTERN, '\~')
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse_label
|
25
|
+
start_line_number = @src.current_line_number
|
26
|
+
@src.pos += @src.matched_size
|
27
|
+
|
28
|
+
namespace = extract_reference_namespace!
|
29
|
+
|
30
|
+
# If we can't find a namespace we just add content as regular text and skip
|
31
|
+
unless namespace
|
32
|
+
add_text(@src[0])
|
33
|
+
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
37
|
+
label_name = @src[:label].delete('"')
|
38
|
+
label_param = label_name.tr(' ', '+')
|
39
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/issues?label_name=#{label_param}"
|
40
|
+
label_attrs = { 'href' => href, 'label' => label_name, 'namespace' => namespace }
|
41
|
+
|
42
|
+
el = Kramdown::Element.new(:label, nil, label_attrs, location: start_line_number)
|
43
|
+
|
44
|
+
@tree.children << el
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -5,8 +5,10 @@ module GitlabKramdown
|
|
5
5
|
# Special GitLab References
|
6
6
|
#
|
7
7
|
# This parser implements any non context-specific reference as described
|
8
|
-
# in the GitLab Flavored Markdown reference
|
8
|
+
# in the GitLab Flavored Markdown reference, except for labels which were
|
9
|
+
# extracted into it's own module.
|
9
10
|
#
|
11
|
+
# @see GitlabKramdown::Parser::Label
|
10
12
|
# @see https://docs.gitlab.com/ee/user/markdown.html#special-gitlab-references
|
11
13
|
module Reference
|
12
14
|
PATH_REGEX = /[a-zA-Z0-9_.][a-zA-Z0-9_\-.]+/.freeze
|
@@ -20,20 +22,20 @@ module GitlabKramdown
|
|
20
22
|
FULL_NAMESPACE_FORMAT_REGEX = %r{(#{NAMESPACE_FORMAT_REGEX}/)*#{NAMESPACE_FORMAT_REGEX}}.freeze
|
21
23
|
ALWAYS_FULL_NAMESPACE_FORMAT_REGEX = %r{(#{NAMESPACE_FORMAT_REGEX}/)+#{NAMESPACE_FORMAT_REGEX}}.freeze
|
22
24
|
|
25
|
+
NAMESPACE_EXTRACTION_PATTERN = /(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})\z/.freeze
|
26
|
+
|
23
27
|
USER_GROUP_PATTERN = %r{
|
24
28
|
#{Regexp.escape('@')}
|
25
29
|
(?<user>#{FULL_NAMESPACE_FORMAT_REGEX})
|
26
30
|
}x.freeze
|
27
31
|
|
28
32
|
PROJECT_COMMIT_PATTERN = %r{
|
29
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
30
33
|
#{Regexp.escape('@')}
|
31
34
|
(?<commit>[a-f0-9]{7,40})
|
32
35
|
(?!\.{3})
|
33
36
|
}x.freeze
|
34
37
|
|
35
38
|
PROJECT_COMMIT_DIFF_PATTERN = %r{
|
36
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
37
39
|
#{Regexp.escape('@')}
|
38
40
|
(?<commit_source>[a-f0-9]{7,40})
|
39
41
|
\.{3}
|
@@ -41,40 +43,27 @@ module GitlabKramdown
|
|
41
43
|
}x.freeze
|
42
44
|
|
43
45
|
PROJECT_ISSUE_PATTERN = %r{
|
44
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
45
46
|
#{Regexp.escape('#')}
|
46
47
|
(?<issue>[1-9][0-9]*)
|
47
48
|
}x.freeze
|
48
49
|
|
49
50
|
PROJECT_MERGE_REQUEST_PATTERN = %r{
|
50
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
51
51
|
#{Regexp.escape('!')}
|
52
52
|
(?<merge_request>[1-9][0-9]*)
|
53
53
|
}x.freeze
|
54
54
|
|
55
55
|
PROJECT_SNIPPET_PATTERN = %r{
|
56
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
57
56
|
#{Regexp.escape('$')}
|
58
57
|
(?<snippet>[1-9][0-9]*)
|
59
58
|
}x.freeze
|
60
59
|
|
61
|
-
PROJECT_LABEL_PATTERN = %r{
|
62
|
-
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
63
|
-
#{Regexp.escape('~')}
|
64
|
-
(?<label>
|
65
|
-
[A-Za-z0-9_\-?.&]+ | # String-based single-word label title, or
|
66
|
-
".+?" # String-based multi-word label surrounded in quotes
|
67
|
-
)
|
68
|
-
}x.freeze
|
69
|
-
|
70
60
|
def self.included(klass)
|
71
61
|
klass.define_parser(:user_group_mention, USER_GROUP_PATTERN, '@')
|
72
|
-
klass.define_parser(:commit, PROJECT_COMMIT_PATTERN, '@')
|
73
62
|
klass.define_parser(:commit_diff, PROJECT_COMMIT_DIFF_PATTERN, '@')
|
63
|
+
klass.define_parser(:commit, PROJECT_COMMIT_PATTERN, '@')
|
74
64
|
klass.define_parser(:issue, PROJECT_ISSUE_PATTERN, '#')
|
75
65
|
klass.define_parser(:merge_request, PROJECT_MERGE_REQUEST_PATTERN, '\!')
|
76
66
|
klass.define_parser(:snippet, PROJECT_SNIPPET_PATTERN, '\$')
|
77
|
-
klass.define_parser(:label, PROJECT_LABEL_PATTERN, '\~')
|
78
67
|
end
|
79
68
|
|
80
69
|
def parse_user_group_mention
|
@@ -94,14 +83,51 @@ module GitlabKramdown
|
|
94
83
|
@tree.children << el
|
95
84
|
end
|
96
85
|
|
86
|
+
# Extract namespace after a reference has been found
|
87
|
+
#
|
88
|
+
# This method provides a workaround for the lack of lookbehind support
|
89
|
+
# in Ruby StringScanner.
|
90
|
+
#
|
91
|
+
# We look at pre_match content (everything before the reference in the same line)
|
92
|
+
# and extract the very last word in the string as long as it matches the
|
93
|
+
# NAMESPACE_EXTRACTION_PATTERN.
|
94
|
+
#
|
95
|
+
# We then modify the last parsed tree element's value, removing the matched
|
96
|
+
# namespace, so that we can process that as part of the reference code.
|
97
|
+
#
|
98
|
+
# @see NAMESPACE_EXTRACTION_PATTERN
|
99
|
+
def extract_reference_namespace!
|
100
|
+
data = @src.pre_match.match(NAMESPACE_EXTRACTION_PATTERN)
|
101
|
+
|
102
|
+
if data
|
103
|
+
namespace = data[:namespace]
|
104
|
+
|
105
|
+
# Remove namespace from last parsed tree value
|
106
|
+
redacted = @tree.children.last.value[0..-(namespace.size + 1)]
|
107
|
+
@tree.children.last.value = redacted
|
108
|
+
end
|
109
|
+
|
110
|
+
namespace
|
111
|
+
end
|
112
|
+
|
97
113
|
def parse_commit
|
98
114
|
start_line_number = @src.current_line_number
|
99
115
|
@src.pos += @src.matched_size
|
100
116
|
|
101
|
-
|
117
|
+
namespace = extract_reference_namespace!
|
118
|
+
reference_text = "#{namespace}#{@src[0]}"
|
119
|
+
|
120
|
+
# If we can't find a namespace we just add content as regular text and skip
|
121
|
+
unless namespace
|
122
|
+
add_text(@src[0])
|
123
|
+
|
124
|
+
return
|
125
|
+
end
|
126
|
+
|
127
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/commit/#{@src[:commit]}"
|
102
128
|
|
103
129
|
el = Kramdown::Element.new(:a, nil, { 'href' => href }, location: start_line_number)
|
104
|
-
add_text(
|
130
|
+
add_text(reference_text, el)
|
105
131
|
@tree.children << el
|
106
132
|
end
|
107
133
|
|
@@ -109,11 +135,21 @@ module GitlabKramdown
|
|
109
135
|
start_line_number = @src.current_line_number
|
110
136
|
@src.pos += @src.matched_size
|
111
137
|
|
112
|
-
|
138
|
+
namespace = extract_reference_namespace!
|
139
|
+
reference_text = "#{namespace}#{@src[0]}"
|
140
|
+
|
141
|
+
# If we can't find a namespace we just add content as regular text and skip
|
142
|
+
unless namespace
|
143
|
+
add_text(@src[0])
|
144
|
+
|
145
|
+
return
|
146
|
+
end
|
147
|
+
|
148
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/compare/" \
|
113
149
|
"#{@src[:commit_source]}...#{@src[:commit_target]}"
|
114
150
|
|
115
151
|
el = Kramdown::Element.new(:a, nil, { 'href' => href }, location: start_line_number)
|
116
|
-
add_text(
|
152
|
+
add_text(reference_text, el)
|
117
153
|
@tree.children << el
|
118
154
|
end
|
119
155
|
|
@@ -121,10 +157,20 @@ module GitlabKramdown
|
|
121
157
|
start_line_number = @src.current_line_number
|
122
158
|
@src.pos += @src.matched_size
|
123
159
|
|
124
|
-
|
160
|
+
namespace = extract_reference_namespace!
|
161
|
+
reference_text = "#{namespace}#{@src[0]}"
|
162
|
+
|
163
|
+
# If we can't find a namespace we just add content as regular text and skip
|
164
|
+
unless namespace
|
165
|
+
add_text(@src[0])
|
166
|
+
|
167
|
+
return
|
168
|
+
end
|
169
|
+
|
170
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/issues/#{@src[:issue]}"
|
125
171
|
|
126
172
|
el = Kramdown::Element.new(:a, nil, { 'href' => href }, location: start_line_number)
|
127
|
-
add_text(
|
173
|
+
add_text(reference_text, el)
|
128
174
|
@tree.children << el
|
129
175
|
end
|
130
176
|
|
@@ -132,10 +178,20 @@ module GitlabKramdown
|
|
132
178
|
start_line_number = @src.current_line_number
|
133
179
|
@src.pos += @src.matched_size
|
134
180
|
|
135
|
-
|
181
|
+
namespace = extract_reference_namespace!
|
182
|
+
reference_text = "#{namespace}#{@src[0]}"
|
183
|
+
|
184
|
+
# If we can't find a namespace we just add content as regular text and skip
|
185
|
+
unless namespace
|
186
|
+
add_text(@src[0])
|
187
|
+
|
188
|
+
return
|
189
|
+
end
|
190
|
+
|
191
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/merge_requests/#{@src[:merge_request]}"
|
136
192
|
|
137
193
|
el = Kramdown::Element.new(:a, nil, { 'href' => href }, location: start_line_number)
|
138
|
-
add_text(
|
194
|
+
add_text(reference_text, el)
|
139
195
|
@tree.children << el
|
140
196
|
end
|
141
197
|
|
@@ -143,22 +199,20 @@ module GitlabKramdown
|
|
143
199
|
start_line_number = @src.current_line_number
|
144
200
|
@src.pos += @src.matched_size
|
145
201
|
|
146
|
-
|
202
|
+
namespace = extract_reference_namespace!
|
203
|
+
reference_text = "#{namespace}#{@src[0]}"
|
147
204
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end
|
205
|
+
# If we can't find a namespace we just add content as regular text and skip
|
206
|
+
unless namespace
|
207
|
+
add_text(@src[0])
|
152
208
|
|
153
|
-
|
154
|
-
|
155
|
-
@src.pos += @src.matched_size
|
209
|
+
return
|
210
|
+
end
|
156
211
|
|
157
|
-
|
158
|
-
href = "#{@options[:gitlab_url]}/#{@src[:namespace]}/issues?label_name=#{label_param}"
|
212
|
+
href = "#{@options[:gitlab_url]}/#{namespace}/snippets/#{@src[:snippet]}"
|
159
213
|
|
160
214
|
el = Kramdown::Element.new(:a, nil, { 'href' => href }, location: start_line_number)
|
161
|
-
add_text(
|
215
|
+
add_text(reference_text, el)
|
162
216
|
@tree.children << el
|
163
217
|
end
|
164
218
|
end
|
@@ -10,6 +10,7 @@ module GitlabKramdown
|
|
10
10
|
autoload :FencedBlockquote, 'gitlab_kramdown/parser/fenced_blockquote'
|
11
11
|
autoload :FencedCodeblock, 'gitlab_kramdown/parser/fenced_codeblock'
|
12
12
|
autoload :Header, 'gitlab_kramdown/parser/header'
|
13
|
+
autoload :Label, 'gitlab_kramdown/parser/label'
|
13
14
|
autoload :Reference, 'gitlab_kramdown/parser/reference'
|
14
15
|
autoload :Strikethrough, 'gitlab_kramdown/parser/strikethrough'
|
15
16
|
end
|
@@ -14,6 +14,7 @@ module Kramdown
|
|
14
14
|
include ::GitlabKramdown::Parser::FencedBlockquote
|
15
15
|
include ::GitlabKramdown::Parser::FencedCodeblock
|
16
16
|
include ::GitlabKramdown::Parser::Header
|
17
|
+
include ::GitlabKramdown::Parser::Label
|
17
18
|
include ::GitlabKramdown::Parser::Reference
|
18
19
|
include ::GitlabKramdown::Parser::Strikethrough
|
19
20
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_kramdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Mazetto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.27.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.27.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.12.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.12.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: asciidoctor-plantuml
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.
|
61
|
+
version: 0.0.15
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.0.
|
68
|
+
version: 0.0.15
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 6.
|
131
|
+
version: 6.6.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 6.
|
138
|
+
version: 6.6.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,19 +197,20 @@ files:
|
|
197
197
|
- lib/gitlab_kramdown/parser/fenced_blockquote.rb
|
198
198
|
- lib/gitlab_kramdown/parser/fenced_codeblock.rb
|
199
199
|
- lib/gitlab_kramdown/parser/header.rb
|
200
|
+
- lib/gitlab_kramdown/parser/label.rb
|
200
201
|
- lib/gitlab_kramdown/parser/reference.rb
|
201
202
|
- lib/gitlab_kramdown/parser/strikethrough.rb
|
202
203
|
- lib/gitlab_kramdown/version.rb
|
203
204
|
- lib/kramdown/parser/gitlab_kramdown.rb
|
204
|
-
homepage: https://gitlab.com/gitlab-org/gitlab_kramdown
|
205
|
+
homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
|
205
206
|
licenses:
|
206
207
|
- MIT
|
207
208
|
metadata:
|
208
|
-
homepage_uri: https://gitlab.com/gitlab-org/gitlab_kramdown
|
209
|
-
source_code_uri: https://gitlab.com/gitlab-org/gitlab_kramdown
|
210
|
-
changelog_uri: https://gitlab.com/gitlab-org/gitlab_kramdown/blob/main/CHANGELOG.md
|
211
|
-
bug_tracker_uri: https://gitlab.com/gitlab-org/gitlab_kramdown/-/issues
|
212
|
-
post_install_message:
|
209
|
+
homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
|
210
|
+
source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown
|
211
|
+
changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown/blob/main/CHANGELOG.md
|
212
|
+
bug_tracker_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab_kramdown/-/issues
|
213
|
+
post_install_message:
|
213
214
|
rdoc_options: []
|
214
215
|
require_paths:
|
215
216
|
- lib
|
@@ -217,15 +218,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
218
|
requirements:
|
218
219
|
- - ">="
|
219
220
|
- !ruby/object:Gem::Version
|
220
|
-
version: 2.7.
|
221
|
+
version: 2.7.5
|
221
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
223
|
requirements:
|
223
224
|
- - ">="
|
224
225
|
- !ruby/object:Gem::Version
|
225
226
|
version: '0'
|
226
227
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
228
|
-
signing_key:
|
228
|
+
rubygems_version: 3.3.5
|
229
|
+
signing_key:
|
229
230
|
specification_version: 4
|
230
231
|
summary: GitLab Flavored Kramdown
|
231
232
|
test_files: []
|