(defun x-dnd-moz-url-to-markdown (window action data)
(let* ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))
(decoded (decode-coding-string data coding))
(sublist (split-string decoded "[\r\n]" t "\@"))
(url (first sublist))
(title (car (last sublist))))
(dnd-insert-text window action (concat "[" title "](" url ")\n"))))
#emacs #lisp #markdown
Emacs lisp code to let you drag and drop URLs as Markdown Show more
Oh, also forgot to mention that you need to edit/customize 'x-dnd-types-alist to include ("text/x-moz-url" . x-dnd-moz-url-to-markdown) instead of the original value - x-dnd-handle-uri-list.