From 2059300b14736a66288151277ed993f2a2b08add Mon Sep 17 00:00:00 2001 From: waddy Date: Tue, 22 Oct 2024 18:27:24 +0900 Subject: [PATCH] =?UTF-8?q?add:=20fuzzyEmail=20=E3=82=92=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/custom-syntax/embed/card.test.ts | 8 ++++++++ packages/zenn-markdown-html/src/index.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/card.test.ts b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/card.test.ts index 3c843ad9..ccf597b5 100644 --- a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/card.test.ts +++ b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/card.test.ts @@ -28,6 +28,14 @@ describe('LinkCard埋め込み要素のテスト', () => { expect(html).toContain('URLが不正です'); }); }); + + describe('メールアドレス', () => { + test('メールアドレスのまま出力する', () => { + const html = markdownToHtml(`ec2-user@33.80.180.159`); + expect(html).toContain('ec2-user@33.80.180.159'); + expect(html).not.toContain('URLが不正です'); + }); + }); }); describe('embedOriginを設定している場合', () => { diff --git a/packages/zenn-markdown-html/src/index.ts b/packages/zenn-markdown-html/src/index.ts index 7dcbfb8c..a7ab5ddb 100644 --- a/packages/zenn-markdown-html/src/index.ts +++ b/packages/zenn-markdown-html/src/index.ts @@ -38,6 +38,7 @@ const markdownToHtml = (text: string, options?: MarkdownOptions): string => { const md = markdownIt({ breaks: true, linkify: true }); md.linkify.set({ fuzzyLink: false }); + md.linkify.set({ fuzzyEmail: false }); // refs: https://github.com/markdown-it/linkify-it md.use(mdBr) .use(mdKatex)