From 932227bbac7fe740bff1e38bf92b58edef19e32f Mon Sep 17 00:00:00 2001 From: default Date: Wed, 8 Jan 2025 16:59:14 +0100 Subject: Bumped copyright year. --- format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'format.c') diff --git a/format.c b/format.c index 41e4162..52ed3ec 100644 --- a/format.c +++ b/format.c @@ -1,5 +1,5 @@ /* snac - A simple, minimalistic ActivityPub instance */ -/* copyright (c) 2022 - 2024 grunfink et al. / MIT license */ +/* copyright (c) 2022 - 2025 grunfink et al. / MIT license */ #include "xs.h" #include "xs_regex.h" -- cgit v1.2.3 From 3d677f67d845cf6e74271681e76d3cb806036483 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 21 Jan 2025 14:33:21 +0100 Subject: Added more Markdown (contributed by an-im-dugud). --- format.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'format.c') diff --git a/format.c b/format.c index 52ed3ec..e5934b8 100644 --- a/format.c +++ b/format.c @@ -92,6 +92,8 @@ static xs_str *format_line(const char *line, xs_list **attach) "`[^`]+`" "|" "~~[^~]+~~" "|" "\\*\\*?\\*?[^\\*]+\\*?\\*?\\*" "|" + "_[^_]+_" "|" //anzu + "__[^_]+__" "|" //anzu "!\\[[^]]+\\]\\([^\\)]+\\)" "|" "\\[[^]]+\\]\\([^\\)]+\\)" "|" "[a-z]+:/" "/[^[:space:]]+" "|" @@ -127,6 +129,20 @@ static xs_str *format_line(const char *line, xs_list **attach) xs *s2 = xs_fmt("%s", s1); s = xs_str_cat(s, s2); } + //anzu - begin + else + if (xs_startswith(v, "__")) { + xs *s1 = xs_strip_chars_i(xs_dup(v), "_"); + xs *s2 = xs_fmt("%s", s1); + s = xs_str_cat(s, s2); + } + else + if (xs_startswith(v, "_")) { + xs *s1 = xs_strip_chars_i(xs_dup(v), "_"); + xs *s2 = xs_fmt("%s", s1); + s = xs_str_cat(s, s2); + } + //anzu - end else if (xs_startswith(v, "~~")) { xs *s1 = xs_strip_chars_i(xs_dup(v), "~"); @@ -303,6 +319,31 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag continue; } + //anzu - begin + // h1 reserved for snac? + if (xs_startswith(ss, "# ")) { + ss = xs_strip_i(xs_crop_i(ss, 2, 0)); + s = xs_str_cat(s, "
", ""); s = xs_replace_i(s, ""); s = xs_replace_i(s, "
", "