fix: make toHtml async

This commit is contained in:
Johann150 2022-08-28 19:48:00 +02:00 committed by Francis Dinh
parent 39a4eea08e
commit 9e309f740e
Signed by: norm
GPG key ID: 7123E30E441E80DE
3 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ import { intersperse } from '@/prelude/array.js';
// Transforms MFM to HTML, given the MFM text and a list of user IDs that are
// mentioned in the text. If the list of mentions is not given, all mentions
// from the text will be extracted.
export function toHtml(mfmText: string, mentions?: string[]): string | null {
export async function toHtml(mfmText: string, mentions?: string[]): string | null {
const nodes = mfm.parse(mfmText);
if (nodes == null) {
return null;

View file

@ -100,7 +100,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw;
const content = toHtml(apText, note.mentions);
const content = await toHtml(apText, note.mentions);
const emojis = await getEmojis(note.emojis);
const apemojis = emojis.map(emoji => renderEmoji(emoji));

View file

@ -65,7 +65,7 @@ export async function renderPerson(user: ILocalUser) {
url: `${config.url}/@${user.username}`,
preferredUsername: user.username,
name: user.name,
summary: profile.description ? toHtml(profile.description) : null,
summary: profile.description ? await toHtml(profile.description) : null,
icon: avatar ? renderImage(avatar) : null,
image: banner ? renderImage(banner) : null,
tag,