Skip to content

Commit

Permalink
Fix email autolink starting w/ @
Browse files Browse the repository at this point in the history
Closes GH-172.

Reviewed-by: Titus Wormer <[email protected]>
  • Loading branch information
yannickgloster committed Apr 23, 2024
1 parent a667828 commit 69b5e0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/micromark-core-commonmark/dev/lib/autolink.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ function tokenizeAutolink(effects, ok, nok) {
return schemeOrEmailAtext
}

if (code === codes.atSign) {
return nok(code)
}

return emailAtext(code)
}

Expand Down
6 changes: 6 additions & 0 deletions test/io/text/autolink.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ test('autolink', function () {
'should not support a dash before a dot in email autolinks'
)

assert.equal(
micromark('<@example.com>'),
'<p>&lt;@example.com&gt;</p>',
'should not support an at sign at the start of email autolinks'
)

assert.equal(
micromark('<[email protected]>', {extensions: [{disable: {null: ['autolink']}}]}),
'<p>&lt;[email protected]&gt;</p>',
Expand Down

0 comments on commit 69b5e0d

Please sign in to comment.