X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=src%2Fviewer.c;h=fa2ea1074272fab58ca71df64f76342bb9045b7b;hb=7b546f2a11460bed09b61116c8be38f8decf0440;hp=bd533e214b97fbe85f6041631c74fdd7632c614e;hpb=35508ded3b1869a9fbe3a239825383677d1c0d75;p=smdp.git diff --git a/src/viewer.c b/src/viewer.c index bd533e2..fa2ea10 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -576,7 +576,7 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colo } void inline_display(WINDOW *window, const char *c, const int colors) { - const static char *special = "\\*_`["; // list of interpreted chars + const static char *special = "\\*_`!["; // list of interpreted chars const char *i = c; // iterator const char *start_link_name, *start_url; int length_link_name, url_num; @@ -637,7 +637,11 @@ void inline_display(WINDOW *window, const char *c, const int colors) { *i == '\\') { // url in pandoc style - if (*i == '[' && strchr(i, ']')) { + if ((*i == '[' && strchr(i, ']')) || + (*i == '!' && *(i + 1) == '[' && strchr(i, ']'))) { + + if (*i == '!') i++; + if (strchr(i, ']')[1] == '(') { i++; @@ -666,7 +670,7 @@ void inline_display(WINDOW *window, const char *c, const int colors) { url_num = url_add(start_link_name, length_link_name, start_url, i - start_url, 0,0); - wprintw(window, "[%d]", url_num); + wprintw(window, " [%d]", url_num); // turn highlighting and underlining off wattroff(window, A_UNDERLINE);