Function: markdown--image-media-handler
markdown--image-media-handler is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown--image-media-handler MIMETYPE DATA)
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown--image-media-handler (mimetype data)
(let* ((ext (symbol-name (mailcap-mime-type-to-extension mimetype)))
(filename (read-string "Insert filename for image: "))
(link-text (read-string "Link text: "))
(filepath (file-name-with-extension filename ext))
(dir (file-name-directory filepath)))
(when (and dir (not (file-directory-p dir)))
(make-directory dir t))
(with-temp-file filepath
(insert data))
(when (string-match-p "\\s-" filepath)
(setq filepath (concat "<" filepath ">")))
(markdown-insert-inline-image link-text filepath)))