diff options
Diffstat (limited to 'src/mfm/parse')
| -rw-r--r-- | src/mfm/parse/elements/mention.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mfm/parse/elements/mention.ts b/src/mfm/parse/elements/mention.ts index a95ec00384..ade5954423 100644 --- a/src/mfm/parse/elements/mention.ts +++ b/src/mfm/parse/elements/mention.ts @@ -2,10 +2,12 @@ * Mention */ import parseAcct from '../../../misc/acct/parse'; +import { toUnicode } from 'punycode'; export type TextElementMention = { type: 'mention' content: string + canonical: string username: string host: string }; @@ -15,9 +17,11 @@ export default function(text: string) { if (!match) return null; const mention = match[0]; const { username, host } = parseAcct(mention.substr(1)); + const canonical = host != null ? `@${username}@${toUnicode(host)}` : mention; return { type: 'mention', content: mention, + canonical, username, host } as TextElementMention; |