branch: elpa/markdown-mode commit fc733be3777c281d5d5e06dacf71cc43109e4a1f Author: Noboru Ota <m...@nobiot.com> Commit: Noboru Ota <m...@nobiot.com>
feat: Add resize inline image without imagemagick This is a small enahcnement to `markdown-toggle-inline-images`, adding a feature to resize the inline display of the image without the need for Imagemagick present in the computer. It uses the existing variable `markdown-max-image-size` to determine the size. Org Mode now is able to do this (see the code in the link below). This feature is intended to emulate it in Markdown-mode. https://github.com/bzg/org-mode/blob/abedf386b3f13af2769728755d00c4698ac5d3b0/lisp/org.el#L16344-L16349 (create-image file-or-data (and (image-type-available-p 'imagemagick) width 'imagemagick) remote? :width width)))) --- markdown-mode.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index b27ad49..64e5ac0 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -8429,13 +8429,17 @@ or \\[markdown-toggle-inline-images]." unhex_file (concat default-directory unhex_file))) (image - (if (and markdown-max-image-size + (cond ((and markdown-max-image-size (image-type-available-p 'imagemagick)) - (create-image - abspath 'imagemagick nil - :max-width (car markdown-max-image-size) - :max-height (cdr markdown-max-image-size)) - (create-image abspath)))) + (create-image + abspath 'imagemagick nil + :max-width (car markdown-max-image-size) + :max-height (cdr markdown-max-image-size))) + (markdown-max-image-size + (create-image abspath nil nil + :max-width (car markdown-max-image-size) + :max-height (cdr markdown-max-image-size))) + (t (create-image abspath))))) (when image (let ((ov (make-overlay start end))) (overlay-put ov 'display image)