- (let ((start (point-marker)))
- (let ((alt (cdr (assq :alt cont)))
- (url (cdr (assq :src cont))))
+ (let ((alt (cdr (assq :alt cont)))
+ (url (cdr (assq :src cont)))
+ (width (cdr (assq :width cont))))
+ ;; Only respect align if width specified.
+ (when width
+ ;; Check that width is not larger than max width, otherwise ignore
+ ;; align
+ (let ((max-width (* shr-width (frame-char-width)))
+ (width (string-to-number width)))
+ (when (< width max-width)
+ (let ((align (cdr (assq :align cont))))
+ (cond
+ ((string= align "right")
+ (insert (propertize
+ " " 'display
+ `(space . (:align-to
+ ,(list (- max-width width)))))))
+ ((string= align "center")
+ (insert (propertize
+ " " 'display
+ `(space . (:balign-to
+ ,(list (- (/ max-width 2) width))))))))))))
+ (let ((start (point-marker)))