Function: markdown-insert-image

markdown-insert-image is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-insert-image)

Documentation

Insert new or update an existing image, with interactive prompt.

If the point is at an existing image, update the alt text, URL, reference label, and/or title. Otherwise, insert a new image. The type of image inserted (inline or reference) depends on which values are provided:

* If a URL and ALT-TEXT are given, insert an inline image:
    ![ALT-TEXT](URL).
* If [REF] and ALT-TEXT are given, insert a reference image:
    ![ALT-TEXT][REF].

If there is an active region, use the text as the default URL, if it seems to be a URL, or alt text value otherwise.

If a given reference is not defined, this function will additionally prompt for the URL and optional title. In this case, the reference definition is placed at the location determined by markdown-reference-location.

Through updating the image, this function can be used to convert an image of one type (inline or reference) to another type by selectively adding or removing information via the prompts.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-insert-image ()
  "Insert new or update an existing image, with interactive prompt.
If the point is at an existing image, update the alt text, URL,
reference label, and/or title. Otherwise, insert a new image.
The type of image inserted (inline or reference) depends on which
values are provided:

*   If a URL and ALT-TEXT are given, insert an inline image:
    ![ALT-TEXT](URL).
*   If [REF] and ALT-TEXT are given, insert a reference image:
    ![ALT-TEXT][REF].

If there is an active region, use the text as the default URL, if
it seems to be a URL, or alt text value otherwise.

If a given reference is not defined, this function will
additionally prompt for the URL and optional title.  In this case,
the reference definition is placed at the location determined by
`markdown-reference-location'.

Through updating the image, this function can be used to convert an
image of one type (inline or reference) to another type by
selectively adding or removing information via the prompts."
  (interactive)
  (markdown--insert-link-or-image t))