Skip to content

Commit

Permalink
Handle mailto link within markdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
keithpitty committed Oct 16, 2015
1 parent 926b0e2 commit abbd034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/slack-notifier/link_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def html_pattern

# http://rubular.com/r/fLEdmTSghW
def markdown_pattern
/\[ ([^\[\]]*?) \] \( (https?:\/\/.*?) \) /x
/\[ ([^\[\]]*?) \] \( ((https?:\/\/.*?) | (mailto:.*?)) \) /x
end

end
Expand Down
5 changes: 5 additions & 0 deletions spec/lib/slack-notifier/link_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
expect(formatted).to eq "こんにちは"
end

it "handles email links in markdown" do
formatted = described_class.format("[John](mailto:john@example.com)")
expect(formatted).to eq "<mailto:john@example.com|John>"
end

end

end

0 comments on commit abbd034

Please sign in to comment.