mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Do a very basic conversion of content if it's markdown.
Peertube videos have this.
This commit is contained in:
parent
65040b65a3
commit
5e7c2257c8
8
html.c
8
html.c
@ -1481,6 +1481,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local,
|
|||||||
/* replace the :shortnames: */
|
/* replace the :shortnames: */
|
||||||
c = replace_shortnames(c, xs_dict_get(msg, "tag"), 2);
|
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", "<br>");
|
||||||
|
}
|
||||||
|
|
||||||
/* c contains sanitized HTML */
|
/* c contains sanitized HTML */
|
||||||
xs_html_add(snac_content,
|
xs_html_add(snac_content,
|
||||||
xs_html_raw(c));
|
xs_html_raw(c));
|
||||||
|
Loading…
Reference in New Issue
Block a user