diff --git a/doc/style.css b/doc/style.css
index 7b4839d..822860e 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -1,5 +1,6 @@
-body { max-width: 48em; margin: auto; line-height: 1.5; padding: 0.8em }
-img { max-width: 100% }
+body { max-width: 48em; margin: auto; line-height: 1.5; padding: 0.8em; word-wrap: break-word; }
+pre { overflow-x: scroll; }
+.snac-embedded-video, img { max-width: 100% }
.snac-origin { font-size: 85% }
.snac-score { float: right; font-size: 85% }
.snac-top-user { text-align: center; padding-bottom: 2em }
diff --git a/format.c b/format.c
index 8c6c02a..fe71996 100644
--- a/format.c
+++ b/format.c
@@ -56,7 +56,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
/* markup */
if (xs_startswith(v, "`")) {
xs *s1 = xs_crop_i(xs_dup(v), 1, -1);
- xs *s2 = xs_fmt("%s
", s1);
+ xs *e1 = encode_html(s1);
+ xs *s2 = xs_fmt("%s
", e1);
s = xs_str_cat(s, s2);
}
else
@@ -134,11 +135,28 @@ xs_str *not_really_markdown(const char *content, xs_list **attach)
continue;
}
- if (in_pre)
- ss = xs_dup(v);
+ if (in_pre) {
+ // Encode all HTML characters when we're in pre element until we are out.
+ ss = encode_html(xs_dup(v));
+
+ s = xs_str_cat(s, ss);
+ s = xs_str_cat(s, "
");
+ continue;
+ }
+
else
ss = xs_strip_i(format_line(v, attach));
+ if (xs_startswith(ss, "---")) {
+ /* delete the --- */
+ ss = xs_strip_i(xs_crop_i(ss, 3, 0));
+ s = xs_str_cat(s, "