mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
Fix hashtag style
This commit is contained in:
parent
84d7a33067
commit
bd32ce514c
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