|
@@ -87,7 +87,12 @@ static xs_str *format_line(const char *line, xs_list **attach)
|
|
|
|
|
|
|
|
|
xs *sm = xs_regex_split(line,
|
|
|
- "(`[^`]+`|\\*\\*?[^\\*]+\\*?\\*|https?:/" "/[^[:space:]]+)");
|
|
|
+ "("
|
|
|
+ "`[^`]+`" "|"
|
|
|
+ "\\*\\*?[^\\*]+\\*?\\*" "|"
|
|
|
+ "\\[[^]]+\\]\\([^\\)]+\\)" "|"
|
|
|
+ "https?:/" "/[^[:space:]]+"
|
|
|
+ ")");
|
|
|
int n = 0;
|
|
|
|
|
|
p = sm;
|
|
@@ -135,6 +140,16 @@ static xs_str *format_line(const char *line, xs_list **attach)
|
|
|
s = xs_str_cat(s, s1);
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ if (*v == '[') {
|
|
|
+
|
|
|
+ xs *w = xs_strip_chars_i(xs_dup(v), "[)");
|
|
|
+ xs *l = xs_split(w, "](");
|
|
|
+ xs *link = xs_fmt("<a href=\"%s\">%s</a>",
|
|
|
+ xs_list_get(l, 1), xs_list_get(l, 0));
|
|
|
+
|
|
|
+ s = xs_str_cat(s, link);
|
|
|
+ }
|
|
|
else
|
|
|
s = xs_str_cat(s, v);
|
|
|
}
|