From 9fc538aa7f16c532869c183b47db670d7aeda879 Mon Sep 17 00:00:00 2001 From: jju1s <123896289+cig13zs@users.noreply.github.com> Date: Tue, 10 Nov 2026 13:26:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Decode=20punycode=20domai?= =?UTF-8?q?ns=20in=20linkified=20email=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- markdown_it/rules_core/linkify.py | 4 +++- tests/test_port/fixtures/linkify.md | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/markdown_it/rules_core/linkify.py b/markdown_it/rules_core/linkify.py index efbc9d4c..19140ecd 100644 --- a/markdown_it/rules_core/linkify.py +++ b/markdown_it/rules_core/linkify.py @@ -95,7 +95,9 @@ def linkify(state: StateCore) -> None: urlText = HTTP_RE.sub( "", state.md.normalizeLinkText("http://" + urlText) ) - elif link.schema == "mailto:" and TEST_MAILTO_RE.search(urlText): + elif link.schema == "mailto:" and not TEST_MAILTO_RE.search( + urlText + ): urlText = MAILTO_RE.sub( "", state.md.normalizeLinkText("mailto:" + urlText) ) diff --git a/tests/test_port/fixtures/linkify.md b/tests/test_port/fixtures/linkify.md index 02a23b17..b6e13875 100644 --- a/tests/test_port/fixtures/linkify.md +++ b/tests/test_port/fixtures/linkify.md @@ -155,6 +155,16 @@ mailto:test@example.com

mailto:test@example.com

. +emails with a punycode domain +. +test@xn--n3h.net + +mailto:test@xn--n3h.net +. +

test@☃.net

+

mailto:test@☃.net

+. + typorgapher should not break href .