diff options
Diffstat (limited to 'src/remote/activitypub/misc')
| -rw-r--r-- | src/remote/activitypub/misc/html-to-mfm.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/remote/activitypub/misc/html-to-mfm.ts b/src/remote/activitypub/misc/html-to-mfm.ts new file mode 100644 index 0000000000..5d3cf0b774 --- /dev/null +++ b/src/remote/activitypub/misc/html-to-mfm.ts @@ -0,0 +1,9 @@ +import { IObject } from '../type'; +import { extractApHashtagObjects } from '../models/tag'; +import { fromHtml } from '../../../mfm/fromHtml'; + +export function htmlToMfm(html: string, tag?: IObject | IObject[]) { + const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null); + + return fromHtml(html, hashtagNames); +} |