aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sx-question-print.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index 02e14c8..d74a162 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -331,9 +331,13 @@ E.g.:
(defconst sx-question-mode--link-regexp
;; Done at compile time.
- (rx "[" (group-n 1 (1+ (not (any "]")))) "]"
- (or (and "(" (group-n 2 (1+ (not (any ")")))) ")")
- (and "[" (group-n 3 (1+ (not (any "]")))) "]")))
+ (rx (or (and "[" (group-n 1 (1+ (not (any "]")))) "]"
+ (or (and "(" (group-n 2 (1+ (not (any ")")))) ")")
+ (and "[" (group-n 3 (1+ (not (any "]")))) "]")))
+ (group-n 4 (and (or (and "http" (opt "s") "://") "")
+ (+ (any alnum "_%"))
+ "."
+ (+ (any alnum "/._%&#?=;"))))))
"Regexp matching markdown links.")
(defun sx-question-mode--fill-and-fontify (text)
@@ -377,6 +381,7 @@ E.g.:
(while (search-forward-regexp sx-question-mode--link-regexp nil t)
(let* ((text (match-string-no-properties 1))
(url (or (match-string-no-properties 2)
+ (match-string-no-properties 4)
(sx-question-mode-find-reference
(match-string-no-properties 3)
text)))
@@ -384,7 +389,7 @@ E.g.:
(when (stringp url)
(replace-match "")
(sx-question-mode--insert-link
- (if sx-question-mode-pretty-links text full-text)
+ (or (if sx-question-mode-pretty-links text full-text) url)
url))))))
(defun sx-question-mode--insert-link (text url)