commit 5e7c225
default
·
2024-01-18 22:15:32 +0000 UTC
parent 65040b6
Do a very basic conversion of content if it's markdown. Peertube videos have this.
1 files changed,
+8,
-0
M
html.c
M
html.c
+8,
-0
1@@ -1481,6 +1481,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
2 /* replace the :shortnames: */
3 c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2);
4
5+ /* Peertube videos content is in markdown */
6+ char *mtype = xs_dict_get(msg, "mediaType");
7+ if (xs_type(mtype) == XSTYPE_STRING && strcmp(mtype, "text/markdown") == 0) {
8+ /* a full conversion could be better */
9+ c = xs_replace_i(c, "\r", "");
10+ c = xs_replace_i(c, "\n", "<br>");
11+ }
12+
13 /* c contains sanitized HTML */
14 xs_html_add(snac_content,
15 xs_html_raw(c));