Use mfm-js for MFM parsing (#7415)

* wip

* Update mfm.ts

* wip

* update mfmjs

* refactor

* nanka

* Update mfm.ts

* Update to-html.ts

* Update to-html.ts

* wip

* fix test

* fix test
This commit is contained in:
syuilo
2021-04-02 10:36:11 +09:00
committed by GitHub
parent b378066ebf
commit 1f4ae2f63a
31 changed files with 262 additions and 1771 deletions

View File

@@ -1,10 +1,10 @@
import { URL } from 'url';
import * as mfm from 'mfm-js';
import renderImage from './image';
import renderKey from './key';
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { toHtml } from '../../../mfm/to-html';
import { parse } from '../../../mfm/parse';
import { getEmojis } from './note';
import renderEmoji from './emoji';
import { IIdentifier } from '../models/identifier';
@@ -66,7 +66,7 @@ export async function renderPerson(user: ILocalUser) {
url: `${config.url}/@${user.username}`,
preferredUsername: user.username,
name: user.name,
summary: toHtml(parse(profile.description)),
summary: profile.description ? toHtml(mfm.parse(profile.description)) : null,
icon: avatar ? renderImage(avatar) : null,
image: banner ? renderImage(banner) : null,
tag,