summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--format.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/format.c b/format.c
index 8c6c02a..0f5f368 100644
--- a/format.c
+++ b/format.c
@@ -139,6 +139,16 @@ xs_str *not_really_markdown(const char *content, xs_list **attach)
139 else 139 else
140 ss = xs_strip_i(format_line(v, attach)); 140 ss = xs_strip_i(format_line(v, attach));
141 141
142 if (xs_startswith(ss, "---")) {
143 /* delete the --- */
144 ss = xs_strip_i(xs_crop_i(ss, 3, 0));
145 s = xs_str_cat(s, "<hr>");
146
147 s = xs_str_cat(s, ss);
148
149 continue;
150 }
151
142 if (xs_startswith(ss, ">")) { 152 if (xs_startswith(ss, ">")) {
143 /* delete the > and subsequent spaces */ 153 /* delete the > and subsequent spaces */
144 ss = xs_strip_i(xs_crop_i(ss, 1, 0)); 154 ss = xs_strip_i(xs_crop_i(ss, 1, 0));
@@ -186,8 +196,8 @@ xs_str *not_really_markdown(const char *content, xs_list **attach)
186 196
187 197
188const char *valid_tags[] = { 198const char *valid_tags[] = {
189 "a", "p", "br", "br/", "blockquote", "ul", "ol", "li", "cite", 199 "a", "p", "br", "br/", "blockquote", "ul", "ol", "li", "cite", "small",
190 "span", "i", "b", "u", "pre", "code", "em", "strong", NULL 200 "span", "i", "b", "u", "pre", "code", "em", "strong", "hr", "img", "del", NULL
191}; 201};
192 202
193xs_str *sanitize(const char *content) 203xs_str *sanitize(const char *content)
@@ -219,7 +229,7 @@ xs_str *sanitize(const char *content)
219 229
220 if (valid_tags[i]) { 230 if (valid_tags[i]) {
221 /* accepted tag: rebuild it with only the accepted elements */ 231 /* accepted tag: rebuild it with only the accepted elements */
222 xs *el = xs_regex_match(v, "(href|rel|class|target)=\"[^\"]*\""); 232 xs *el = xs_regex_match(v, "(src|href|rel|class|target)=\"[^\"]*\"");
223 xs *s3 = xs_join(el, " "); 233 xs *s3 = xs_join(el, " ");
224 234
225 s2 = xs_fmt("<%s%s%s%s>", 235 s2 = xs_fmt("<%s%s%s%s>",