diff options
-rw-r--r-- | sx-question-print.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sx-question-print.el b/sx-question-print.el index e872d01..51c047c 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -436,7 +436,7 @@ E.g.: (group-n 4 (and (and "http" (opt "s") "://") "" (>= 2 (any lower numeric "_%")) "." - (>= 2 (any lower numeric "/._%&#?=;")))))) + (>= 2 (any lower numeric "/-._%&#?=;")))))) "Regexp matching markdown links.") (defun sx-question-mode--process-markdown-in-region (beg end) @@ -562,9 +562,10 @@ Image links are downloaded and displayed, if (when (stringp url) (replace-match "") (sx-question-mode--insert-link - (unless image-p - (or (if sx-question-mode-pretty-links text full-text) - url)) + (cond (image-p nil) + ((and sx-question-mode-pretty-links text)) + ((not text) (sx--shorten-url url)) + (t full-text)) url) (when image-p (sx-question-mode--create-image url (- (point) 2)))))))))) @@ -606,7 +607,9 @@ URL is used as 'help-echo and 'url properties." ;; Mouse-over 'help-echo (format sx-button--link-help-echo - (propertize (sx--shorten-url url) + ;; If TEXT is a shortened url, we don't shorten URL. + (propertize (if (string-match "^https?:" (or text "")) + url (sx--shorten-url url)) 'face 'font-lock-function-name-face)) ;; For visiting and stuff. 'sx-button-url url |