Fix hashtag style
This commit is contained in:
parent
c60517e49a
commit
68d43e43b6
1 changed files with 3 additions and 2 deletions
|
@ -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('@');
|
||||||
|
|
Loading…
Reference in a new issue