Fix hashtag style

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-03-15 00:03:24 +09:00 committed by GitHub
parent 84d7a33067
commit bd32ce514c

View file

@ -39,10 +39,11 @@ export function fromHtml(html: string): string {
const txt = getText(node); const txt = getText(node);
const rel = node.attrs.find((x: any) => x.name == 'rel'); const rel = node.attrs.find((x: any) => x.name == 'rel');
const href = node.attrs.find((x: any) => x.name == 'href'); const href = node.attrs.find((x: any) => x.name == 'href');
const isHashtag = rel && rel.value.match('tag') !== null;
// ハッシュタグ / hrefがない / txtがURL // ハッシュタグ / hrefがない / txtがURL
if ((rel && rel.value.match('tag') !== null) || !href || href.value == txt) { if (isHashtag || !href || href.value == txt) {
text += txt.match(urlRegex) ? txt : `<${txt}>`; text += isHashtag || txt.match(urlRegex) ? txt : `<${txt}>`;
// メンション // メンション
} else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) { } else if (txt.startsWith('@') && !(rel && rel.value.match(/^me /))) {
const part = txt.split('@'); const part = txt.split('@');