Skip to content

Commit

Permalink
fix handling of shorthand email links - closes #41
Browse files Browse the repository at this point in the history
also add test case for it
  • Loading branch information
notslang committed Sep 23, 2016
1 parent f58f172 commit 71922b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/converters.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ module.exports = [
"[#{content}]"
else
"[#{content}][#{referenceLink.name}]"
else if not title and url isnt '' and content is url
"<#{url}>"
else if not title and url isnt '' and
(content is url or content is url.replace(/^mailto:/, ''))
"<#{content}>"
else if title
"[#{content}](#{url} \"#{title}\")"
else
Expand Down
7 changes: 7 additions & 0 deletions test/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,13 @@ describe 'inline grammar', ->
'<https://github.com/slang800/tidy-markdown>'
)

it 'should handle shorthand email links', ->
tidyMdSnippet(
'<[email protected]>'
).should.equal(
'<[email protected]>'
)

it 'should handle reference links', ->
tidyMdSnippet('''
[NPM version][npm-url]
Expand Down

0 comments on commit 71922b3

Please sign in to comment.