Skip to content

Commit 93cb155

Browse files
committed
Fix #autolink for greenmat
1 parent b1381ba commit 93cb155

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/qiita/markdown/greenmat/html_renderer.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ def initialize(extensions = {})
1212
end
1313

1414
# https://github.com/vmg/redcarpet/blob/v3.2.3/ext/redcarpet/html.c#L76-L116
15-
def autolink(link, _link_type)
16-
%(<a href="#{link}" class="autolink">#{link}</a>)
15+
def autolink(link, link_type)
16+
if link_type == :email
17+
%(<a href="mailto:#{link}" class="autolink">#{link}</a>)
18+
else
19+
%(<a href="#{link}" class="autolink">#{link}</a>)
20+
end
1721
end
1822

1923
def header(text, level)

spec/qiita/markdown/processor_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
it "replaces with mailto link" do
5353
should eq <<-EOS.strip_heredoc
54-
<p><a href="mailto:test@example.com">test@example.com</a></p>
54+
<p><a href="mailto:test@example.com" class="autolink">test@example.com</a></p>
5555
EOS
5656
end
5757
end

0 commit comments

Comments
 (0)