From ba80f6594f39b09a6212f1288297ad1a6124dcbe Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 24 Jan 2015 01:25:41 -0200 Subject: Clean up nested links --- sx-question-print.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sx-question-print.el') diff --git a/sx-question-print.el b/sx-question-print.el index 924608b..0528944 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -409,6 +409,14 @@ Image links are downloaded and displayed, if (defun sx-question-mode--insert-link (text-or-image url) "Return a link propertized version of TEXT-OR-IMAGE. URL is used as 'help-echo and 'url properties." + ;; For now, the only way to handle nested links is to remove them. + (when (eq (char-before) ?\[) + (insert "a") + (forward-char -2) + (if (looking-at sx-question-mode--link-regexp) + (replace-match "") + (forward-char 1) + (delete-char 1))) (let ((imagep (not (stringp text-or-image)))) ;; Images need to be at the start of a line. (when (and imagep (not (looking-at-p "^"))) -- cgit v1.2.3