Language: EN

como-usar-imagenes-en-markdown

How to use images in Markdown

To insert an image in Markdown, a syntax very similar to that of links is used. The basic syntax for inserting an image is as follows:

![Alt Text](url de la imagen)

Where:

  • ![Alt Text] is the text that is displayed when the image cannot be loaded or to provide a description of the image for accessibility.
  • (URL de la Imagen) is the address where the image is located. This URL can be a link to an image on the web or a relative path to a local file.

By default, images in Markdown are very limited in terms of options. We cannot specify size, or alt.

Basic Example

Suppose we have an image called kitten.jpg in the same folder as your Markdown file, the syntax to insert it would be:

![Kitten Photo](foto-de-gatito.jpg)

If the image is hosted online, for example, on a web server, you can use the full URL:

![Kitten Photo](https://www.luisllamas.es/foto-de-gatito.jpg)

If we render it… oh, a photo of a kitten!

foto-gatito

The image “foto-de-gatito.jpg” will not work for you because it is an example. Replace it with a public image that you can access.

Best Practices Tips

  1. Image Size: Make sure that images are not too large to avoid slow loading times. Compress images if necessary.
  2. Image Format: Use appropriate image formats for the content, such as PNG for graphics with text and JPEG for photographs.
  3. Accessibility: Provide meaningful descriptions in the alt text to improve the accessibility of your documents.