diff options
Diffstat (limited to '')
| -rw-r--r-- | format.c | 14 |
1 files changed, 11 insertions, 3 deletions
| @@ -56,7 +56,8 @@ static xs_str *format_line(const char *line, xs_list **attach) | |||
| 56 | /* markup */ | 56 | /* markup */ |
| 57 | if (xs_startswith(v, "`")) { | 57 | if (xs_startswith(v, "`")) { |
| 58 | xs *s1 = xs_crop_i(xs_dup(v), 1, -1); | 58 | xs *s1 = xs_crop_i(xs_dup(v), 1, -1); |
| 59 | xs *s2 = xs_fmt("<code>%s</code>", s1); | 59 | xs *e1 = encode_html(s1); |
| 60 | xs *s2 = xs_fmt("<code>%s</code>", e1); | ||
| 60 | s = xs_str_cat(s, s2); | 61 | s = xs_str_cat(s, s2); |
| 61 | } | 62 | } |
| 62 | else | 63 | else |
| @@ -134,8 +135,15 @@ xs_str *not_really_markdown(const char *content, xs_list **attach) | |||
| 134 | continue; | 135 | continue; |
| 135 | } | 136 | } |
| 136 | 137 | ||
| 137 | if (in_pre) | 138 | if (in_pre) { |
| 138 | ss = xs_dup(v); | 139 | // Encode all HTML characters when we're in pre element until we are out. |
| 140 | ss = encode_html(xs_dup(v)); | ||
| 141 | |||
| 142 | s = xs_str_cat(s, ss); | ||
| 143 | s = xs_str_cat(s, "<br>"); | ||
| 144 | continue; | ||
| 145 | } | ||
| 146 | |||
| 139 | else | 147 | else |
| 140 | ss = xs_strip_i(format_line(v, attach)); | 148 | ss = xs_strip_i(format_line(v, attach)); |
| 141 | 149 | ||