From 5e7c2257c82871d55deacc468c2332dc5563f380 Mon Sep 17 00:00:00 2001 From: default Date: Thu, 18 Jan 2024 23:15:32 +0100 Subject: [PATCH] Do a very basic conversion of content if it's markdown. Peertube videos have this. --- html.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/html.c b/html.c index c08cb11..e02c62b 100644 --- a/html.c +++ b/html.c @@ -1481,6 +1481,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, /* replace the :shortnames: */ c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2); + /* Peertube videos content is in markdown */ + char *mtype = xs_dict_get(msg, "mediaType"); + if (xs_type(mtype) == XSTYPE_STRING && strcmp(mtype, "text/markdown") == 0) { + /* a full conversion could be better */ + c = xs_replace_i(c, "\r", ""); + c = xs_replace_i(c, "\n", "
"); + } + /* c contains sanitized HTML */ xs_html_add(snac_content, xs_html_raw(c));