aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-09-28 00:13:17 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-09-28 00:13:42 +0200
commita13b91d64c96670caff1ea9830b7e4a90ad81eaa (patch)
treee0815ba027359708ddaf69156e27507240a2267c
parent94ddbec88e57fe742f219a30145650165887f22c (diff)
html.c: Replace \n with <br> on html_encode
This replacement can come in handy for library users dealing with multi-line user-generated content.
-rw-r--r--html.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/html.c b/html.c
index 4af536e..f06b336 100644
--- a/html.c
+++ b/html.c
@@ -47,7 +47,8 @@ char *html_encode(const char *s)
{.c = '<', .str = "&lt;"},
{.c = '&', .str = "&amp;"},
{.c = '\"', .str = "&quot;"},
- {.c = '\'', .str = "&apos;"}
+ {.c = '\'', .str = "&apos;"},
+ {.c = '\n', .str = "<br>"}
};
char buf[sizeof "a"] = {0};