summaryrefslogtreecommitdiff
path: root/src/remote/activitypub/misc/html-to-mfm.ts
blob: 5cca04df21529b5f7d41d3ae04ade621d2bfd0d7 (plain)
1
2
3
4
5
6
7
8
9
import { IObject } from '../type';
import { extractApHashtagObjects } from '../models/tag';
import { fromHtml } from '../../../mfm/from-html';

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);
}