mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
[mastodon-client] Omit paragraph tags for user profile fields
This commit is contained in:
parent
8c93f7eb68
commit
9167ba593c
2 changed files with 4 additions and 3 deletions
|
@ -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 a new issue