diff options
| author | 2024-01-18 23:15:32 +0100 | |
|---|---|---|
| committer | 2024-01-18 23:15:32 +0100 | |
| commit | 5e7c2257c82871d55deacc468c2332dc5563f380 (patch) | |
| tree | bd3b4448e31398393cb00a611fdd0992e856893a | |
| parent | New function get_atto(), to get the attributedTo field. (diff) | |
| download | snac2-5e7c2257c82871d55deacc468c2332dc5563f380.tar.gz snac2-5e7c2257c82871d55deacc468c2332dc5563f380.tar.xz snac2-5e7c2257c82871d55deacc468c2332dc5563f380.zip | |
Do a very basic conversion of content if it's markdown.
Peertube videos have this.
| -rw-r--r-- | html.c | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -1481,6 +1481,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, | |||
| 1481 | /* replace the :shortnames: */ | 1481 | /* replace the :shortnames: */ |
| 1482 | c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2); | 1482 | c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2); |
| 1483 | 1483 | ||
| 1484 | /* Peertube videos content is in markdown */ | ||
| 1485 | char *mtype = xs_dict_get(msg, "mediaType"); | ||
| 1486 | if (xs_type(mtype) == XSTYPE_STRING && strcmp(mtype, "text/markdown") == 0) { | ||
| 1487 | /* a full conversion could be better */ | ||
| 1488 | c = xs_replace_i(c, "\r", ""); | ||
| 1489 | c = xs_replace_i(c, "\n", "<br>"); | ||
| 1490 | } | ||
| 1491 | |||
| 1484 | /* c contains sanitized HTML */ | 1492 | /* c contains sanitized HTML */ |
| 1485 | xs_html_add(snac_content, | 1493 | xs_html_add(snac_content, |
| 1486 | xs_html_raw(c)); | 1494 | xs_html_raw(c)); |