From 68d43e43b61254803a307605043ffeab08ca6fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Fri, 15 Mar 2019 00:03:24 +0900 Subject: [PATCH] Fix hashtag style --- src/mfm/fromHtml.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mfm/fromHtml.ts b/src/mfm/fromHtml.ts index 330ebdde0..369f9de0e 100644 --- a/src/mfm/fromHtml.ts +++ b/src/mfm/fromHtml.ts @@ -39,10 +39,11 @@ export function fromHtml(html: string): string { const txt = getText(node); const rel = node.attrs.find((x: any) => x.name == 'rel'); const href = node.attrs.find((x: any) => x.name == 'href'); + const isHashtag = rel && rel.value.match('tag') !== null; // ハッシュタグ / hrefがない / txtがURL - if ((rel && rel.value.match('tag') !== null) || !href || href.value == txt) { - text += txt.match(urlRegex) ? txt : `<${txt}>`; + if (isHashtag || !href || href.value == txt) { + text += isHashtag || txt.match(urlRegex) ? txt : `<${txt}>`; // メンション } else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) { const part = txt.split('@');