mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
[mastodon-client] Omit paragraph tags for user profile fields
This commit is contained in:
parent
8c93f7eb68
commit
9167ba593c
@ -110,7 +110,7 @@ export class UserConverter {
|
||||
private static encodeField(f: Field): MastodonEntity.Field {
|
||||
return {
|
||||
name: f.name,
|
||||
value: MfmHelpers.toHtml(mfm.parse(f.value)) ?? escapeMFM(f.value),
|
||||
value: MfmHelpers.toHtml(mfm.parse(f.value), undefined, true) ?? escapeMFM(f.value),
|
||||
verified_at: f.verified ? (new Date()).toISOString() : null,
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ import mfm from "mfm-js";
|
||||
export class MfmHelpers {
|
||||
public static toHtml(
|
||||
nodes: mfm.MfmNode[] | null,
|
||||
mentionedRemoteUsers: IMentionedRemoteUsers = []
|
||||
mentionedRemoteUsers: IMentionedRemoteUsers = [],
|
||||
inline: boolean = false
|
||||
) {
|
||||
if (nodes == null) {
|
||||
return null;
|
||||
@ -203,6 +204,6 @@ export class MfmHelpers {
|
||||
|
||||
appendChildren(nodes, doc.body);
|
||||
|
||||
return `<p>${doc.body.innerHTML}</p>`;
|
||||
return inline ? doc.body.innerHTML : `<p>${doc.body.innerHTML}</p>`;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user