From aa9a6b63ad0540ef2ee863c73d7999ef56b088a7 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Tue, 23 Apr 2024 10:13:50 +0200 Subject: [PATCH] Fix email autolink starting w/ `@` Related-to: micromark/micromark#172. --- src/construct/autolink.rs | 1 + tests/autolink.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/construct/autolink.rs b/src/construct/autolink.rs index 8a2f90c..3d72f27 100644 --- a/src/construct/autolink.rs +++ b/src/construct/autolink.rs @@ -162,6 +162,7 @@ pub fn open(tokenizer: &mut Tokenizer) -> State { tokenizer.consume(); State::Next(StateName::AutolinkSchemeOrEmailAtext) } + Some(b'@') => State::Nok, _ => State::Retry(StateName::AutolinkEmailAtext), } } diff --git a/tests/autolink.rs b/tests/autolink.rs index e06d9b0..f41c6b1 100644 --- a/tests/autolink.rs +++ b/tests/autolink.rs @@ -251,6 +251,12 @@ fn autolink() -> Result<(), message::Message> { "should not support a dash before a dot in email autolinks" ); + assert_eq!( + to_html("<@example.com>"), + "

<@example.com>

", + "should not support an at sign at the start of email autolinks" + ); + assert_eq!( to_html_with_options( "", -- 2.51.2